Jump to content

How do I add github dependencies to build.gradle?


That_Martin_Guy

Recommended Posts

A mod I want to create requires CoFH core, and I see no source download for this. Therefore I go onto their github and try and add the clone command found there to my build.gradle 

dependencies { compile 'https://github.com/CoFH/CoFHCore.git' }

(The code isn't actually all on one line, the formatter was just not happy with me copy pasting it.)

 

I run "gradlew setupDecompWorkspace --refresh-dependencies", followed by gradlew dependencies, but it says lines like

testRuntime - Runtime dependencies for source set 'test'.
\--- https://github.com/CoFH/CoFHCore.git: FAILED

.

 

So instead I use  

compile 'scm:git:git://github.com/CoFH/CoFHCore.git'

which I found in their build.gradle, but it provides a similar result. What am I doing wrong?

Link to comment
Share on other sites

26 minutes ago, diesieben07 said:

You can't add github repositories as a dependency by default. You can use something like https://jitpack.io/ though.

I did find an existing version of CoFH-Core on there, but when I ran gradlew dependencies it showed

testRuntime - Runtime dependencies for source set 'test'.
+--- com.github.CoFH:CoFHCore:a19dbc5eea
|    \--- mezz.jei:jei_1.11.2:4.5.0.+ FAILED

Is this an error on CoFH's part? I don't think 4.5.0.+ is a valid version of JEI (I might be wrong though). Also, I tried adding my own version of JEI, also via jitpack, but JEI doesn't show up in game, and no new files are created in my project directory. Is this intended? Do I still need a jar for viewing the CoFH's source code in my IDE?

Edited by That_Martin_Guy
Link to comment
Share on other sites

So I simply cloned the 1.10.2 branch (since that is the version I'm working on) and moved the src folders to my project. However, I get a ton of errors in IDEA (mostly related to IDEA not recognizing it should compile for java 1.8). If I try to use gradlew runClient with the dependencies in build.gradle it tells me this:

> Could not find mezz.jei:jei_1.10.2:3.14.7.416.
  Searched in the following locations:
      http://files.minecraftforge.net/maven/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.pom
      http://files.minecraftforge.net/maven/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.jar
      https://repo1.maven.org/maven2/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.pom
      https://repo1.maven.org/maven2/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.jar
      https://libraries.minecraft.net/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.pom
      https://libraries.minecraft.net/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.jar
      https://jitpack.io/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.pom
      https://jitpack.io/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.jar
      file:/C:/Users/Axel/.gradle/caches/minecraft/deobfedDeps/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.pom
      file:/C:/Users/Axel/.gradle/caches/minecraft/deobfedDeps/mezz/jei/jei_1.10.2/3.14.7.416/jei_1.10.2-3.14.7.416.jar
      file:/D:/Java Projects/Minecraft Mods/Brighten Up/.gradle/minecraft/jei_1.10.2-3.14.7.416.jar
      file:/D:/Java Projects/Minecraft Mods/Brighten Up/.gradle/minecraft/jei_1.10.2.jar

. If I remove the dependencies from build.gradle the output still gives a ton of errors, mostly it telling me not to use code only available in java 1.7+. What did I do wrong?

Link to comment
Share on other sites

6 hours ago, That_Martin_Guy said:

I did find an existing version of CoFH-Core on there, but when I ran gradlew dependencies it showed


testRuntime - Runtime dependencies for source set 'test'.
+--- com.github.CoFH:CoFHCore:a19dbc5eea
|    \--- mezz.jei:jei_1.11.2:4.5.0.+ FAILED

Is this an error on CoFH's part? I don't think 4.5.0.+ is a valid version of JEI (I might be wrong though). Also, I tried adding my own version of JEI, also via jitpack, but JEI doesn't show up in game, and no new files are created in my project directory. Is this intended? Do I still need a jar for viewing the CoFH's source code in my IDE?

 

You need add the dependency repositories used by CoFH to your build.gradle file manually, JitPack doesn't seem to handle that automatically.

 

Basically, copy the repositories from the repositories section of CoFHCore's build.gradle file into the repositories section of your build.gradle file. Use the repositories sections in the main body, not in the buildscript section.

 

I also had to add the universal classifier to the CoFHCore dependency, e.g. deobfCompile 'com.github.CoFH:CoFHCore:f60b7b70fe:universal'.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
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.
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.

Announcements



×
×
  • Create New...

Important Information

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