Nerd For Tech
Published in

Nerd For Tech

The better Maven Central

Maven Central is the most used repository for Java artifacts. Almost every Gradle file starts with:

buildscript {
repositories {
mavenCentral()
// maybe other repos here

Yet publishing with Sontatype, OSSHR and Nexus (this article explains the terms really well) is a very slow and painful process:

Source: https://jfrog.com/blog/bintray-as-pain-free-gateway-to-maven-central/.

You could argue that Jfrog is biased but I fully agree with all the statements above. Now that the Jfrog alternative JCenter is gone, there’s imo only one solution left for open source projects and that solution is amazing: jitpack.io.

Amazing because there’s literally no effort to publish artifacts once the maven or maven-publish plugin have been configured (which needs to be done in any case) -> see my other article here.

If you have a GitHub account there’s almost nothing to do to get Jitpack.io. going. Just grant Jitpack.io access to your public repos and you’re done. And with done I mean literally done.

Jitpack.io is so simple that I didn’t even notice that my artifacts e.g. for this repo: https://github.com/1gravity/Android-RTEditor were automatically published (while I worked on the Maven Central publication). Jitpack automatically built and published my library:

  • because it has access to my repos
  • because I tagged my commits with a version number, e.g. v1.7.3
  • because the maven-publish task was configured
  • because jitpack.io is an awesome tool ;-)

To use the published artifacts you need to add jitpack.io as a Maven repo but that’s the only tiny drawback compared to artifacts published in Maven Central:

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

I don’t need to go through Sonatype’s painful signup process and I don’t need to set up a build pipeline in the open source repository of my choice.

I did this for Android projects (e.g. here and here) and backend Java projects (e.g. here), it’s equally simple.

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

Data Streaming Platform Using Kafka, Kubernetes, MongoDB, InfluxDB and Grafana. Part 1

How to automate your git workflow

Regression Service in Ruby on Rails (Part1)

How to make a Django Serializer

Tomcat Server - Request Size

Resources

CSS3 Coding Conventions

KING OF APP

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
Emanuel Moecklin

Emanuel Moecklin

More from Medium

Dagger 2’s naming convention is suboptimal, let’s fix it

Kotlin data class copy and equal behavior need to know.

Transformations in encapsulated LiveData

Mastering refactoring