AdityaGupta1 / mobycraft

A Minecraft client-side mod to manage and visualize Docker containers in Minecraft
Apache License 2.0
35 stars 7 forks source link

Create a fat jar for the mod #11

Closed arun-gupta closed 8 years ago

arun-gupta commented 8 years ago

Here is the updated build.gradle:


// For those who want the bleeding edge
buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.github.johnrengelman.shadow'

/*
// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot
plugins {
    id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

minecraft {
    version = "1.8.9-11.15.1.1722"
    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 = "stable_20"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

shadowJar {
  dependencies {
    include(dependency('com.github.docker-java:docker-java:2.2.1'))
  }
}

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 group: 'com.github.docker-java', name: 'docker-java', version: '2.2.1'

    // 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

}

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

Here is the complete maven dependency tree:

[INFO] \- com.github.docker-java:docker-java:jar:2.2.1:compile
[INFO]    +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.1.2:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-core:jar:2.1.2:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.1.2:compile
[INFO]    |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.1:compile
[INFO]    |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.1.2:compile
[INFO]    +- org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.11:compile
[INFO]    |  +- org.glassfish.jersey.core:jersey-common:jar:2.11:compile
[INFO]    |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO]    |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.11:compile
[INFO]    |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO]    |  \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.3.1:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.3:compile
[INFO]    |  \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO]    +- org.glassfish.jersey.core:jersey-client:jar:2.11:compile
[INFO]    |  +- org.glassfish.hk2:hk2-api:jar:2.3.0-b05:compile
[INFO]    |  |  +- org.glassfish.hk2:hk2-utils:jar:2.3.0-b05:compile
[INFO]    |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.3.0-b05:compile
[INFO]    |  +- org.glassfish.hk2.external:javax.inject:jar:2.3.0-b05:compile
[INFO]    |  \- org.glassfish.hk2:hk2-locator:jar:2.3.0-b05:compile
[INFO]    |     \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO]    +- de.gesellix:unix-socket-factory:jar:2015-01-27T15-02-14:compile
[INFO]    +- org.apache.commons:commons-compress:jar:1.5:compile
[INFO]    |  \- org.tukaani:xz:jar:1.2:compile
[INFO]    +- commons-codec:commons-codec:jar:1.8:compile
[INFO]    +- commons-lang:commons-lang:jar:2.6:compile
[INFO]    +- commons-io:commons-io:jar:2.3:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO]    +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO]    +- com.google.guava:guava:jar:18.0:compile
[INFO]    \- org.bouncycastle:bcpkix-jdk15on:jar:1.51:compile
[INFO]       \- org.bouncycastle:bcprov-jdk15on:jar:1.51:compile
AdityaGupta1 commented 8 years ago

Need to work with @arun-gupta on this

arun-gupta commented 8 years ago

Looking for help at http://www.minecraftforge.net/forum/index.php/topic,37371.msg197016.html

AdityaGupta1 commented 8 years ago

Done