Jump to content

Using External Libraries in my mod


Asweez

Recommended Posts

Ok I've done some more testing and tweaking, but still no luck.

 

I found that the error is that shadowJar can't find Gradle's JavaPlugin class.

 

 

* Exception is:
java.lang.NoClassDefFoundError: org.gradle.api.plugins.JavaPlugin
at com.github.jengelman.gradle.plugins.shadow.ShadowPlugin.class$(ShadowPlugin.groovy)

 

 

Here is my build.gradle, what am I doing wrong?

 

 

buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
    }
}

plugins{
    id 'java'
    id "com.github.johnrengelman.shadow" version "1.2.2"
}

apply plugin: 'forge'

version = "1.0"
group= "com.apmods.hpspells" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "hpspells"

minecraft {
    version = "1.7.10-10.13.4.1614-1.7.10"
    runDir = "eclipse"
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

shadowJar {
    dependencies{
        include(dependency("edu.cmu.sphinx:sphinx4-core:5prealpha-SNAPSHOT"))
        include(dependency("edu.cmu.sphinx:sphinx4-data:5prealpha-SNAPSHOT"))
    }
}


 

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

in your build.gradle you need to apply the plugins before you can use them.

 

. . .

apply plugin: 'forge'

apply plugin: 'java' // or 'groovy'. Must be explicitly applied

apply plugin: 'com.github.johnrengelman.shadow'

. . .

 

Ok I've done some more testing and tweaking, but still no luck.

 

I found that the error is that shadowJar can't find Gradle's JavaPlugin class.

 

 

* Exception is:
java.lang.NoClassDefFoundError: org.gradle.api.plugins.JavaPlugin
at com.github.jengelman.gradle.plugins.shadow.ShadowPlugin.class$(ShadowPlugin.groovy)

 

 

Here is my build.gradle, what am I doing wrong?

 

 

buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
    }
}

plugins{
    id 'java'
    id "com.github.johnrengelman.shadow" version "1.2.2"
}

apply plugin: 'forge'

version = "1.0"
group= "com.apmods.hpspells" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "hpspells"

minecraft {
    version = "1.7.10-10.13.4.1614-1.7.10"
    runDir = "eclipse"
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

shadowJar {
    dependencies{
        include(dependency("edu.cmu.sphinx:sphinx4-core:5prealpha-SNAPSHOT"))
        include(dependency("edu.cmu.sphinx:sphinx4-data:5prealpha-SNAPSHOT"))
    }
}


 

Link to comment
Share on other sites

The same error as before, nothing changed. No I haven't because I don't use your library, but I will try the test project.

 

My sphinx4 libraries are located in my src/main/resources folder path.

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

So I put the sphinx4 source code in my mod, but it references apache commons math. I don't want to put that in my mod because it will probably be incompatible with other mods that use commons math. How do I get around this?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria 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.