Create a library available on Jitpack.io
suggest changePerform the following steps to create the library:
- Create a GitHub account.
- Create a Git repository containing the library project.
- Add this to the library module
build.gradle:
apply plugin: 'com.github.dcendents.android-maven'
...
// Build a jar with source files.
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
// Build a jar with javadoc.
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
Make sure that you commit/push the above changes to GitHub.
- Push the changes and create a GitHub release or tag.
- JitPack builds that tag when a project requests it.
gradlew installonly writes to the local Maven repository. It does not publish the library to JitPack. - In the app that uses the library, add the JitPack repository and the dependency:
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.[YourUser]:[github repository name]:[release tag]'
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents