I recently got the following Problem:
There were an API that needs to be implemented for a SpongePlugin and everytime I tried to build it, Gradle failed at ‘:compileJava’. I figured the problem had to be that the API I want to implement, wasn’t properly added through Gradle. The manual import was the problem.
So I figured i need to import the GitHub repo of this api-plugin with Gradle. After long research I got the following solution. Just add the following to your gradle.build
-file after the plugin{...}
section:
allprojects{
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
This adds the JitPack Plugin to Gradle with will help you to import any GitHub repo as dependency through this (just add the repo in the dependeny list like this):
dependencies {
...
compile 'com.github.Username:Reponame:Tag
}
An example: compile 'com.github.Jano1:RegionsAPI:master-SNAPSHOT'
If there are no Tags set, you can use ‘branchname-SNAPSHOT’ to get the current state of the branch you want.
For further information about JitPack: JitPack.io
I hope I can spare some of you some time with this