Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

  • Author

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

 

 

  • Author
5 hours ago, diesieben07 said:

You put your JGit dependency in the "shadow" configuration, but you never use that anywhere.

What should I do with it?

  • Author
1 hour ago, diesieben07 said:

Don't do anything with it, you should not have it at all.

What.

If I don't have it in the dependencies, it won't work...

  • Author
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)

 

 

  • Author
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

 

 

  • Author

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

  • Author
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

  • Author

It will load fine, yes.  But actually trying to use any of the methods I add to computercraft doesn't work (unless I'm using runClient.  runClient always works).

  • Author

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

  • Author

I do not know.  The part of my code which is called by ccgit.init is here, perhaps it would be possible to modify in some way?  Most of the Lua <> Java stuff is handled by CCTweaks, ComputerCraft, and LuaJ.

  • Author

Thank You!  Thank you SO MUCH.  I was so confused and you helped me figure it out -- and it wasn't easy either.  Again, thank you.  I will add you to the credit when I release the mod :)

  • 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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.