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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

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