Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • ForgeGradle
  • how can i embed a dependancy from maven
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
lukas2005

how can i embed a dependancy from maven

By lukas2005, October 27, 2017 in ForgeGradle

  • Reply to this topic
  • Start new topic

Recommended Posts

lukas2005    9

lukas2005

lukas2005    9

  • Diamond Finder
  • lukas2005
  • Forge Modder
  • 9
  • 289 posts
Posted October 27, 2017

i tried to do this using embed 'group:artifact:version' thing from here https://github.com/MinecraftForge/ForgeGradle/wiki/Dependencies

 

but got this error:

Spoiler

* What went wrong:
Execution failed for task ':reobfJar'.
> java.util.zip.ZipException: duplicate entry: META-INF/LICENSE

 

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6680

diesieben07

diesieben07    6680

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6680
  • 45687 posts
Posted October 27, 2017

Check out: https://github.com/johnrengelman/shadow

  • Quote

Share this post


Link to post
Share on other sites

lukas2005    9

lukas2005

lukas2005    9

  • Diamond Finder
  • lukas2005
  • Forge Modder
  • 9
  • 289 posts
Posted October 28, 2017
23 hours ago, diesieben07 said:

Check out: https://github.com/johnrengelman/shadow

how do i use this to embed things from maven?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6680

diesieben07

diesieben07    6680

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6680
  • 45687 posts
Posted October 28, 2017

You read it's documentation.

  • Quote

Share this post


Link to post
Share on other sites

lukas2005    9

lukas2005

lukas2005    9

  • Diamond Finder
  • lukas2005
  • Forge Modder
  • 9
  • 289 posts
Posted October 29, 2017

but how do i include it i tried this: 

Spoiler
buildscript {
    repositories {
        jcenter()
        maven { url = "http://files.minecraftforge.net/maven" }
  maven { url = "https://dl.bintray.com/johnrengelman/gradle-plugins/"}
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
  classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
version = "0.0.4"
group = "io.github.lukas2005.lda" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "lda"
def jxbrowser_version = "6.16"
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = "1.8"
}
minecraft {
    version = "1.11.2-13.20.1.2386"
    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 always work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20161220"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
//Add "embedded" configuration
configurations {
    embed
    compile.extendsFrom(embed)
}
dependencies {
 embed 'com.google.apis:google-api-services-youtube:v3-rev186-1.23.0'
 embed files("libs/vorbisspi1.0.3.jar")
 embed files("libs/tritonus_share.jar")
 embed files("libs/jorbis-0.0.15.jar")
 embed files("libs/jogg-0.0.7.jar")
 
 embed files("libs/jxbrowser/licence.jar")
 embed files("libs/jxbrowser/lib/jxbrowser-6.16.jar")
 
    // 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"
     
    // 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
}
//Add dependencies to the JAR
jar {
    from configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
}
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 except the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

but i get this error:

* What went wrong:
A problem occurred configuring root project 'Device-Mod-Apps'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find shadow.jar (com.github.jengelman.gradle.plugins:shadow:1.2.4).
     Searched in the following locations:
         https://jcenter.bintray.com/com/github/jengelman/gradle/plugins/shadow/1.2.4/shadow-1.2.4.jar

  • Quote

Share this post


Link to post
Share on other sites

lukas2005    9

lukas2005

lukas2005    9

  • Diamond Finder
  • lukas2005
  • Forge Modder
  • 9
  • 289 posts
Posted October 29, 2017 (edited)

i managed to solve that issue now i have another 

i have this build.gradle:

Spoiler
buildscript {
    repositories {
  mavenCentral()
  maven { url = "http://files.minecraftforge.net/maven" }
  maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
  classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
compileJava.options.encoding = 'UTF-8'
version = "0.0.4"
group = "io.github.lukas2005.lda" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "lda"
def jxbrowser_version = "6.16"
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
    sourceCompatibility = targetCompatibility = "1.8"
}
minecraft {
    version = "1.11.2-13.20.1.2386"
    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 always work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20161220"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
//Add "embedded" configuration
configurations {
    embed
    compile.extendsFrom(embed)
}
dependencies {
 embed 'com.google.apis:google-api-services-youtube:v3-rev186-1.23.0'
 embed files("libs/vorbisspi1.0.3.jar")
 embed files("libs/tritonus_share.jar")
 embed files("libs/jorbis-0.0.15.jar")
 embed files("libs/jogg-0.0.7.jar")
 
 embed files("libs/jxbrowser/licence.jar")
 embed files("libs/jxbrowser/lib/jxbrowser-6.16.jar")
 
    // 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"
     
    // 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
}
//Add dependencies to the JAR
jar {
    from configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
}
// Let Shadow do its thing
jar.finalizedBy shadowJar
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 except the mcmod.info
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

but now i have the original error how do i fix this? 

 

PS also tried to add

shadowJar {
 exclude 'META-INF/LICENSE'
}

with no succes

 

Edited October 29, 2017 by lukas2005
  • Quote

Share this post


Link to post
Share on other sites

Gepetto    0

Gepetto

Gepetto    0

  • Tree Puncher
  • Gepetto
  • Members
  • 0
  • 1 post
Posted January 15, 2018

Add this to you jar block in build.gradle. Depending on what jars you embed, there might be some that need certain entries in their META-INF\MANIFEST.MF; add those entries into your mod's META-INF\MANIFEST.MF. Also you might have to instruct shadow to remap the embedded jar's classes into the package of your mod.

 

from configurations.embed.collect {
    it.isDirectory() ? it : zipTree(it).matching {
        exclude 'META-INF', 'META-INF/**'
    }
}
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Draco18s
      MoonPhase help

      By Draco18s · Posted 40 minutes ago

      Events don't return values. Second, I'm pretty sure getMoonPhase() is client side only.
    • GatoLeyo
      MoonPhase help

      By GatoLeyo · Posted 44 minutes ago

      Im new at modding so probably this have an obvious error but plz somebody tell me how can i make this works, it is intended to return a value in relation to the moon phase       public float endWorldTick(TickEvent.WorldTickEvent event)      {         float x = 0;         if(event.side.isServer() && event.phase == TickEvent.Phase.END)          {             World world = event.world;             if(world.provider.getDimension() == 0) {                 if(world.getMoonPhase() == 1.0f)                  {                   x = 15.0f;                 }             }         }         return x;     }  
    • DaemonUmbra
      Can't see anything on minecraft menu screen except for the bottom left corner

      By DaemonUmbra · Posted 1 hour ago

      Please don't Necro old threads, if you have an issue make your own.
    • DaemonUmbra
      Forge having problem loading mods

      By DaemonUmbra · Posted 1 hour ago

      You changed "Game Directory" to your mods folder. The Game Directory is supposed to be the folder that contains the mods folder, .minecraft by default
    • Casual
      1.12.2 crash on game start

      By Casual · Posted 1 hour ago

      Ok to add on, had to do manual library install due to failed library install thing, also there is never another window It just closes the launcher window and then reopens it with the error.
  • Topics

    • GatoLeyo
      1
      MoonPhase help

      By GatoLeyo
      Started 45 minutes ago

    • florgonn
      4
      Can't see anything on minecraft menu screen except for the bottom left corner

      By florgonn
      Started July 30, 2014

    • SilviaX_92
      3
      Forge having problem loading mods

      By SilviaX_92
      Started 4 hours ago

    • Casual
      1
      1.12.2 crash on game start

      By Casual
      Started 1 hour ago

    • PulseBeat_02
      14
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By PulseBeat_02
      Started December 13, 2018

  • Who's Online (See full list)

    • saxon564
    • AnonymousVoidF
    • dylandmrl
    • Cadiboo
    • SilviaX_92
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • ForgeGradle
  • how can i embed a dependancy from maven
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community