Jump to content

metadaddy

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    Older than the average modder!

metadaddy's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. YES! Got this all working, thanks to some input from LexManos and GUIpsp on my pull request. The key is to use the Gradle Shadow plugin to relocate the external classes so they don't get excluded by FML, and there's no risk of clashing with different versions of the same JARs in other mods. Here's by build.gradle in its entirety, so you can see how it all works buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' classpath 'eu.appsatori:gradle-fatjar-plugin:0.2-rc1' classpath 'com.github.jengelman.gradle.plugins:shadow:0.8' } } apply plugin: 'shadow' shadow { classifier = 'mod' // My mod jar ends up as build/distributions/Forcecraft-1.7.2-0.2.0-mod.jar artifactSet { include 'us.forcecraft' // My mod's main package } relocation { pattern = 'argo' shadedPattern = 'us.forcecraft.argo' } relocation { pattern = 'org.apache' shadedPattern = 'us.forcecraft.org.apache' } relocation { pattern = 'org.cometd' shadedPattern = 'us.forcecraft.org.cometd' } relocation { pattern = 'org.eclipse' shadedPattern = 'us.forcecraft.org.eclipse' } } apply plugin: 'forge' version = "1.7.2-0.2.0" group= "us.forcecraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Forcecraft" minecraft { version = "1.7.2-10.12.1.1060" assetDir = "eclipse/assets" } 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' } } // Include external libs in compilation and jar configurations { external compile.extendsFrom external } dependencies { external 'net.sourceforge.argo:argo:2.25' external 'org.cometd.java:bayeux-api:2.2.0' external 'org.cometd.java:cometd-java-client:2.2.0' external 'org.cometd.java:cometd-java-common:2.2.0' external 'commons-logging:commons-logging:1.1.3' external 'commons-codec:commons-codec:1.6' external 'org.apache.httpcomponents:httpclient:4.3.3' external 'org.apache.httpcomponents:httpcore:4.3.2' external 'org.eclipse.jetty:jetty-client:7.4.0.v20110414' external 'org.eclipse.jetty:jetty-http:7.4.0.v20110414' external 'org.eclipse.jetty:jetty-io:7.4.0.v20110414' external 'org.eclipse.jetty:jetty-util:7.4.0.v20110414' } jar { from { configurations.external.collect { it.isDirectory() ? it : zipTree(it) } } } // Let Shadow do its thing build.dependsOn shadowJar
  2. OK - the good news - I figured out the Gradle magic to include dependent JARs in your mod JAR. At the end of build.gradle, add: configurations { external compile.extendsFrom external } dependencies { external 'org.apache.httpcomponents:httpclient:4.3.3' external 'org.apache.httpcomponents:httpcore:4.3.2' // etc } jar { from { configurations.external.collect { it.isDirectory() ? it : zipTree(it) } } } The bad news - mods using org.apache JARs will still not work, due to a bug in FML: https://github.com/MinecraftForge/FML/issues/424
  3. I have exactly the same problem. Forge loads whatever you put in the mods directory, but the actual mod can't 'see' its dependencies. Perhaps they are all loaded into different class loaders. In 1.6.4, I wrote a script to extract all the class files from the dependent libraries into the same directory as the mod itself, and jar the whole lot up together. I'm trying to figure out how to do the same in Gradle rather an a shell script. If I figure it out, I'll post it back here.
×
×
  • Create New...

Important Information

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