Jump to content

Trouble with API Dependencies [intelliJ/ForgeGradle]


perry

Recommended Posts

I have a libs folder in my project root with the Blood Magic API inside (Blood Magic API - v1.1.0 (1.7.10).zip).

My build.gradle file is as follows:

buildscript {
    repositories {
        mavenCentral()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
}

apply plugin: 'scala'
apply plugin: 'forge'

version = "0.1"
group= "com.perry.automation" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "automation"

minecraft {
    version = "1.7.10-10.13.0.1205"
    assetDir = "eclipse/assets"
}

dependencies {
    compile 'com.google.code.findbugs:jsr305:1.3.9'
    compile group: 'com.google.guava', name: 'guava', version: '12.0'
    compile fileTree(dir: 'libs', include: '*.zip')
    compile fileTree(dir: 'libs', include: '*.jar')
}

processResources
{
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    // replace stuff in mcmod.info, nothing else
    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        // replace version and mcversion
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    // copy everything else, thats not the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

 

However in intelliJ I cannot import any of the classes from the API.

Further I used to be able to expand the API in the libs folder and see the classes inside it, now I just get a yellow highlight over the zip and cannot expand it from intelliJ. (See http://i.imgur.com/QVTP0mh.png)

 

Any ideas?

Link to comment
Share on other sites

Okay so I just started using Intellij today as well (making the switch from Eclipse because, why the hell not?) and I had almost the same problem.

 

This is what I did to solve it:

 

File -> Project Structure -> Modules -> Dependencies (add) Jars or Directories

 

Anyway, now the jars I add there are included as libraries for my project. This is of course, assuming this is actually what you want to do. The other alternative if you have API class files is just to create a directory under src called "api/java" and set it as a source directory in Project Structure. It should not get compiled out to your eventual mod.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.