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.