Jump to content

External Dependency does not work in Normal MC


KingofGamesYami

Recommended Posts

I've found several posts in various places about this, but the syntax in every case is outdated.  I am shading JGit.  It and it's dependencies end up in my jar, but slf4j crashes on launch causing general horribleness.

 

Spoiler

buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

version = "2.0"
group= "org.kingofgamesyami.ccgit" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ccgit"

sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = "1.6"
}

minecraft {
    version = "1.10.2-12.18.3.2316"
    runDir = "run"
    
    // the mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   snapshot are built nightly.
    // stable_#            stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not allways work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20161111"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

    //something that might help?
}

configurations {
    shade
    compile.extendsFrom shade
}

repositories {
    maven { url = "https://crzd.me/files/maven/" }
    maven { url = "https://dl.bintray.com/squiddev/maven" }
    maven { url = "https://repo.eclipse.org/content/groups/releases/" }
}

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"

    compile "dan200.computercraft:ComputerCraft:1.80pr0-build0"
    compile "org.squiddev:CCTweaks:1.10.2-1.5.0-pr0:dev"

    shade 'org.eclipse.jgit:org.eclipse.jgit:4.5.0.201609210915-r'

    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
    //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
    // except that these dependencies get remapped to your current MCP mappings
    //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

jar {
    configurations.shade.each { dep ->
        from(project.zipTree(dep)){
            exclude 'META-INF', 'META-INF/**'
        }
    }
}

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'
    }
}

 

 

Edited by KingofGamesYami
Link to comment
Share on other sites

Trying shadow out, gradlew build no longer functions.  Repeated "error: package org.eclipse.jgit.api does not exist" for all imports.  I have no idea what I'm doing wrong, as I followed the shadow introduction exactly and nothing seems to be wrong with my build.gradle...

 

Spoiler

buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
    }
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

version = "2.0"
group= "org.kingofgamesyami.ccgit" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ccgit"

sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = "1.6"
}

minecraft {
    version = "1.10.2-12.18.3.2316"
    runDir = "run"
    
    // the mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   snapshot are built nightly.
    // stable_#            stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not allways work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20161111"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

    //something that might help?
}

repositories {
    maven { url = "https://crzd.me/files/maven/" }
    maven { url = "https://dl.bintray.com/squiddev/maven" }
    maven { url = "https://repo.eclipse.org/content/groups/releases/" }
}

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"

    compile "dan200.computercraft:ComputerCraft:1.80pr0-build0"
    compile "org.squiddev:CCTweaks:1.10.2-1.5.0-pr0:dev"

    shadow 'org.eclipse.jgit:org.eclipse.jgit:4.5.0.201609210915-r'

    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
    //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
    // except that these dependencies get remapped to your current MCP mappings
    //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

/*jar {
    configurations.shade.each { dep ->
        from(project.zipTree(dep)){
            exclude 'META-INF', 'META-INF/**'
        }
    }
}*/

shadowJar {
    baseName = 'shadow'
    classifier = null
    version = null
    configurations = [project.configurations.compile]
}

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'
    }
}

build.dependsOn shadowJar

 

 

Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

I did not say to not put it in dependencies. I said to not use a separate config.

Ah, so also use compile.  Tried that, it worked (well, compiled), but ended up with the same results as using "shade" : log4j crashes immediately, and nothing about my mod works.  Attempting to use any method I add results in an error referring to log4j.

Spoiler

2017-06-16 11:37:28,362 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
  <log4j:Event logger="LaunchWrapper" timestamp="1497631048388" level="INFO" thread="main">
    <log4j:Message><![CDATA[Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker]]></log4j:Message>
  </log4j:Event>
expected <
2017-06-16 11:37:31,559 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2017-06-16 11:37:31,560 WARN Caught Exception while in Loader.getResource. This may be innocuous. java.lang.IllegalArgumentException: name
	at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:494)
	at sun.misc.URLClassPath.findResource(URLClassPath.java:176)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:557)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:555)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findResource(URLClassLoader.java:554)
	at java.lang.ClassLoader.getResource(ClassLoader.java:1093)
	at org.apache.logging.log4j.core.helpers.Loader.getResource(Loader.java:98)
	at org.apache.logging.log4j.core.config.ConfigurationFactory.getInputFromResource(ConfigurationFactory.java:300)
	at org.apache.logging.log4j.core.config.ConfigurationFactory.getInputFromString(ConfigurationFactory.java:280)
	at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:380)
	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:377)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:149)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:85)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:34)
	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:387)
	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:322)
	at net.minecraft.client.Minecraft.<clinit>(Minecraft.java:208)
	at net.minecraft.client.main.Main.main(SourceFile:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

2017-06-16 11:37:31,575 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
  <log4j:Event logger="net.minecraft.client.Minecraft" timestamp="1497631051742" level="INFO" thread="Client thread">
    <log4j:Message><![CDATA[Setting user: KingofGamesYami]]></log4j:Message>
  </log4j:Event>
expected <
MultiModel minecraft:builtin/missing is empty (no base model or parts were provided/resolved)

 

 

Link to comment
Share on other sites

Spoiler

buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
    }
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

version = "2.0"
group= "org.kingofgamesyami.ccgit" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ccgit"

sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = "1.6"
}

minecraft {
    version = "1.10.2-12.18.3.2316"
    runDir = "run"
    
    // the mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   snapshot are built nightly.
    // stable_#            stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not allways work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20161111"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

    //something that might help?
}

repositories {
    maven { url = "https://crzd.me/files/maven/" }
    maven { url = "https://dl.bintray.com/squiddev/maven" }
    maven { url = "https://repo.eclipse.org/content/groups/releases/" }
}

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"

    compile "dan200.computercraft:ComputerCraft:1.80pr0-build0"
    compile "org.squiddev:CCTweaks:1.10.2-1.5.0-pr0:dev"

    compile 'org.eclipse.jgit:org.eclipse.jgit:4.5.0.201609210915-r'

    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
    //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
    // except that these dependencies get remapped to your current MCP mappings
    //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

/*
jar {
    configurations.compile.each { dep ->
        from(project.zipTree( dep )){
            exclude 'META-INF', 'META-INF/**'
        }
    }
}
*/

shadowJar {
    dependencies {
        exclude( dependency( 'dan200.computercraft:ComputerCraft:1.80pr0-build0') )
        exclude( dependency( 'org.squiddev:CCTweaks:1.10.2-1.5.0-pr0:dev' ) )
    }
}

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'
    }
}

build.dependsOn shadowJar

 

 

Link to comment
Share on other sites

Done!  Apologies if anything is missing, I tired to exclude anything which wouldn't be needed.

 

Edit: Almost forgot, you're probably not familiar with ComputerCraft.  Once you have the game running, get an advanced computer, place it, right click to open the GUI.  Type in "lua" to enter the lua console.  Type "ccgit.init( "/test" )" to try to create a git repo.  It will show an error message.  If it doesn't, I want to know why it works for you and not me XD.

Edited by KingofGamesYami
Link to comment
Share on other sites

7 minutes ago, diesieben07 said:

The ComputerCraft dependency cannot be resolved.

Ah, the custom build server is down.  It was run by a member of the community, looks like he moved it or something. I'll PM some people about it.  You can get it here for 1.11.2 (which my mod is compatible with), though you'll need a newer version of CCTweaks for the mods folder (not to compile against). moved to here.

Edited by KingofGamesYami
Link to comment
Share on other sites

Reproduction Steps:

1. Clone repo

2. gradlew build

3. Add ccgit-2.0-all to mods folder with CCTweaks and ComputerCraft.

4. Launch game using minecraft launcher

5. Place an advanced computer

6. Open Lua console. (type lua)

7. Attempt to create repository (type ccgit.init( 'test' ))

8. Observe Java Exception Thrown: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

9. Attempt to open repository (type ccgit.open( 'test'))

10. Observe Java Exception Thrown: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jgit.internal.storage.file.FileRepository

 

 

Edited by KingofGamesYami
Link was broken
Link to comment
Share on other sites

  • 1 year later...

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm opening the forge 1.8.9 installer properly I click install with the client option selected, it says it installs properly but when I go into my files and also when I go into the minecraft launcher, it's just not there.  JVM info: Oracle Corporation - 1.8.0_431 - 25.431-b10 java.net.preferIPv4Stack=true Found java version 1.8.0_431 Considering minecraft client jar Considering library net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9: Not Downloading {Wrong Side} Considering library net.minecraft:launchwrapper:1.12: Not Downloading {Wrong Side} Considering library org.ow2.asm:asm-all:5.0.3: Not Downloading {Wrong Side} Considering library jline:jline:2.13: Not Downloading {Wrong Side} Considering library com.typesafe.akka:akka-actor_2.11:2.3.3 Considering library com.typesafe:config:1.2.1 Considering library org.scala-lang:scala-actors-migration_2.11:1.1.0 Considering library org.scala-lang:scala-compiler:2.11.1 Considering library org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2 Considering library org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2 Considering library org.scala-lang:scala-library:2.11.1 Considering library org.scala-lang:scala-parser-combinators_2.11:1.0.1 Considering library org.scala-lang:scala-reflect:2.11.1 Considering library org.scala-lang:scala-swing_2.11:1.0.1 Considering library org.scala-lang:scala-xml_2.11:1.0.2 Considering library lzma:lzma:0.0.1: Not Downloading {Wrong Side} Considering library net.sf.jopt-simple:jopt-simple:4.6: Not Downloading {Wrong Side} Considering library java3d:vecmath:1.5.2 Considering library net.sf.trove4j:trove4j:3.0.3 Extracting: /forge-1.8.9-11.15.1.2318-1.8.9-universal.jar To: C:\Users\Ian\AppData\Roaming\.minecraft\libraries\net\minecraftforge\forge\1.8.9-11.15.1.2318-1.8.9\forge-1.8.9-11.15.1.2318-1.8.9.jar That's the installer log and I have no idea if anything is wrong.
    • https://mclo.gs/NQ786zI   I don’t understand what I need to do.
    • I am wanting to give the armour in my mod special properties, but I have no idea how to do so.   For the first armour set I want it to be the case that when the full set is worn it has the properties of a carved pumpkin, making it so you won't aggravate endermen when you look at them.    The second, and presumably harder property is that for the second set I would like it to be the case that when the full set is worn, you can walk over the void without falling. (I was considering using the levitation to accomplish this but I wanted to check beforehand).   Would both of these specialities be achievable for each armour set and how exactly would they both be done? Help would be much appreciated. 
    • I finally got my Forge server up and running thanks to the help of the people on this forum and played fine for a day. Now since I started playing today, the server runs for 20-30 minutes then freezes and kicks everyone out but stays up and running but won't let anyone connect. Here is the latest debug log and crashlog from the server. Thank you for reading & helping   https://gist.github.com/Dwolfwoood/d0410e581c86772694f1d8007431c409   https://gist.github.com/Dwolfwoood/b5d521fd071dbfcc816949924757fef9
    • I got the infamous crash log that you get when you have a mod or multiple mods that are incompatible with the version being used. however.. I have no idea which ones are wrong. I was hoping the forums could help me figure it out. does the crsh report tell me and im just dumb?  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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