Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JitPack repository in Gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler
apply plugin:JitPackRepositoryPlugin
class JitPackRepositoryPlugin implements Plugin<Gradle> {
void apply(Gradle gradle) {
gradle.allprojects { project ->
project.repositories.metaClass.jitpack = { String org = null, String subPattern = null, def closure = null ->
delegate.maven {
url "https://jitpack.io"
}
}
}
}
}
@jitpack-io

This comment has been minimized.

Copy link
Owner Author

jitpack-io commented Dec 7, 2015

Copy this script to $HOME/.gradle/init.gradle

Then you can use jitpack repository in all your buildfiles with this syntax:

repository {
    jitpack()
}
@VigneshPeriasami

This comment has been minimized.

Copy link

VigneshPeriasami commented Dec 7, 2015

This registers jitpack only to project repositories, any idea how to get this working for buildscript repositories, couldn't get it to work for the following code.

buildscript {
  repositories {
     jitpack()
  }
}

Adding the following line to $HOME/.gradle/init.gradle will do the work

apply from: "https://gist.githubusercontent.com/jitpack-io/380e88da1a5b3efe695b/raw/5b824f213dc1aeeed8e1c3e914135d93c3fcca4d/init.gradle"
@jitpack-io

This comment has been minimized.

Copy link
Owner Author

jitpack-io commented Dec 8, 2015

@vignesh-iopex Thanks for the tip! Not sure how to make it work with buildscript repositories. It's probably a matter of finding the right api so might be an idea to ask in Gradle forums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.