Guide to publishing libraries

In order to publish your library on JitPack you just need a working build file in your Git repository.

JitPack currently can build Gradle, Maven, Sbt and Leiningen projects. Let us know if you want to use it with other build tools.

If the project has a build.gradle file then it will be built using Gradle otherwise JitPack will look for a pom.xml, build.sbt or project.clj file. The build.gradlefile can also be located in a subfolder.

Gradle projects

Projects using Gradle need to have either the maven or maven-publishing plugin enabled. For example, if you add this to your build file:

apply plugin: 'maven'

group = 'com.github.YourUsername'

then JitPack will run:

./gradlew install

to install the jar and pom file in it’s local maven repository. With maven-publishing plugin it will run

./gradlew build publishToMavenLocal

Note that if your project isn’t using a Gradle wrapper JitPack will build it with a recent version of Gradle. Therefore it is recommended to use the wrapper.

Example projects

Android projects

See the Guide to publishing Android libraries with Gradle

Maven projects

JitPack will run:

mvn install -DskipTests

to build and publish Maven projects. If your project requires a specific Maven version then you can use the Maven Wrapper. In that case JitPack will run:

./mvnw install -DskipTests

Example projects

Multi-module projects

If the project builds multiple modules JitPack publish all of them. It will also generate a module that includes all of repository’s modules as dependencies. That way if you don’t know which module you want you can get all of them by adding just a single dependency to your build file.

To get individual artifacts of multi-module builds use com.github.User.Repo as group Id and ModuleName as the artifact Id.

Individual module in Gradle:

compile 'com.github.User.Repo:Module:Tag'

or in Maven:


Tip: You can see a list of modules on if you Look Up your repository.

To get all modules of a project use the standard syntax:

compile 'com.github.User:Repo:Tag'

Note: If your project only has a single module then the dependency for that module is just com.github.User:Repo:Tag.


Sbt projects

JitPack can build sbt projects and also provide dependencies to sbt. When building an Sbt project JitPack will run:

sbt publishM2

To use JitPack repository from sbt add this to build.sbt:

resolvers += "jitpack" at ""

and then use:

libraryDependencies += "com.github.User" % "Repo" % "Tag"

JitPack also supports cross-building with the %% syntax:

libraryDependencies += "com.github.User" %% "Repo" % "Tag"

which will build the dependency with your current Scala version by calling sbt ++SCALA_VERSION.

Leiningen projects

When building a Leiningen project JitPack will run:

lein do clean, install

To use JitPack from Leiningen add the repository to your project.clj:

:repositories [["jitpack" ""]]

and then the dependency:

:dependencies [[com.github.User/Repo "Tag"]]

Build environment

Each build will have these environment variables:

And the following project specific environment variables:

Build customization

You can create a jitpack.yml file in the root of your repository and override the build commands:

  - oraclejdk8
   - ./
   - echo "Running a custom install command"
   - mvn clean install -DskipTests
   MYVAR: "custom environment variable"

The install command is expected to create build artifacts somewhere in the project’s directory andalso to copy them to the local Maven repository ~/.m2/repository.

Environment variables

Custom environment variables can be set using the env section as key-value pairs. They will be available to your build on JitPack.

Additionally, you can configure environment variables in the Web UI on Look up your repository and click settings. This is useful if you don’t want to store environment variables in git.

Java version

JitPack will compile projects using Oracle Java 8. See the example projects on how to set a different target version in your build file.

Maven projects that specify a target version in their pom will be built with that target version.

If your project uses Travis or Circle CI then JitPack will read the lowest jdk version from yml file and use that to build.

Alternatively create a jitpack.yml file in the root of your repository and specify a jdk version:

  - oraclejdk8


If there is an issue with a build you will see a link to the log in the Status column.

Build log

You can also inspect the build log using the URL:

and browse the files:

Although we monitor builds feel free to get in touch any time you face an issue or click the Report button. The easiest way is to open a GitHub issues or come chat on

Building ahead of time

You can also build snapshots on each commit if you add GitHub Webhooks.

To add, head to repository Settings -> Webhooks & Services -> Add webhook.

Webhook URL:

Content type: application/json

The webhook will trigger a build for branches that you have previously used with JitPack. So make sure you have requested master-SNAPSHOT from JitPack before adding a webhook.


You can remove builds that didn’t succeed if you Sign In on and look up your repository. Requesting them again will result in the project being rebuilt.

You may need to run gradle with --refresh-dependencies flag in order to re-fetch the dependency. In maven use the -U flag.

Clean gradle cache

To clean the Gradle cache delete the HOME_DIR/.gradle/caches directory.