To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.User:Repo:Tag'
}
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo</artifactId>
<version>Tag</version>
</dependency>
libraryDependencies += "com.github.User" % "Repo" % "Tag"
:dependencies [[com.github.User/Repo "Tag"]]
Step 2. Add the token to $HOME/.gradle/gradle.properties
authToken=AUTHENTICATION_TOKEN
Then use authToken as the username in your build.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven {
url "https://jitpack.io"
credentials { username authToken }
}
}
}
Step 2. Add the token to $HOME/.m2/settings.xml as the username
<settings>
<servers>
<server>
<id>jitpack.io</id>
<username>AUTHENTICATION_TOKEN</username>
<password>.</password>
</server>
</servers>
</settings>
The id of the server must be the same you use in your pom.xml
Step 2. Add the token to $HOME/.sbt/.credentials file
realm=JitPack
host=jitpack.io
user=AUTHENTICATION_TOKEN
password=.
Then add credentials to your Sbt build file
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
Step 2. Add the token to project.clj
:repositories [["jitpack" { :url "https://jitpack.io"
:username "AUTHENTICATION_TOKEN"
:password "." }]]
Step 3. (Optional) You may need to approve JitPack Application on GitHub
Build artifacts (jar, aar) are also private and you can only download them if you have access to the Git repo itself.
See the documentation on how to authenticate with other providers (Bitbucket, GitLab, custom) or to use SSH key authentication.
JitPack is always free for open-source
JitPack Subscription enables you to build and install from private Git repositories
Which repositories would you like to build?
* available as an add-on
Enterprise plans available upon request
Invite a friend and get a month for free when they subscribe