Publish an Android Library by JitPack

余威毅
余威毅
Mar 6, 2017 · 2 min read
Image for post
Image for post
reference

JitPack is a novel package repository for JVM and Android projects. It builds Git projects on demand and provides you with ready-to-use artifacts (jar, aar).

Steps

1. Create an Android project and add a library module, here my library module name is mylibrary.

Image for post
Image for post

2. Add the android-maven plugin in your project/build.gradle

Image for post
Image for post

3. In your library/build.gradle add maven plugin and group setting

Image for post
Image for post
replace ‘your_github_name’ to your account

4. Upload this project to your github

5. Create a release tag

Image for post
Image for post
5–1. click the ‘releases’ tab
Image for post
Image for post
5–2. click ‘Draft a new release’
Image for post
Image for post
5–3. fill out the release information form then Publish release

6. Open JitPack and lookup your repository

Image for post
Image for post
6–1. paste your github repo url
Image for post
Image for post
6–2. click ‘Get it’ on the version you want
Image for post
Image for post
6–3. you can also use branch to get the latest code

7. Now you can get your library from JitPack!

Image for post
Image for post

Other Git Hosts

JitPack also works with other Git hosting providers. The only difference is the groupId of your artifacts:

  • BitBucket: org.bitbucket.Username:Repo:Tag
  • GitLab: com.gitlab.Username:Repo:Tag

Private Repos

Currently seems only github and bitbucket are works.(2017/03/06)

References

Example project on github

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store