Now Sonatype has deprecated the old workflow and wants people to move to their new Central Portal to publish things to Maven Central. And looking through the documentation on how to use the Central Portal, it seems like Sonatype has been moving away from all-in-one publishing scripts. Instead, their documentation seems to describe how to cobble together separate plugins to package everything together, resulting in a fully customizable approach to publishing a library. In particular, they recommend using their new central-publishing-maven-plugin for uploading libraries to the Central Portal, but this Maven plugin only does the deployment. It doesn't do anything with preparing and packaging your library to be uploaded. So it was not clear how to move from using the maven-release-plugin that does everything to using this central-publishing-maven-plugin which only does the upload part.
Fortunately, it turns out the two plugins are compatible. If you already have a working maven-release-plugin workflow, then you just have to add the central-publishing-maven-plugin to the Maven build files. The central-publishing-maven-plugin will extend the existing deploy code to support deploying to the new Central Portal, and when you run the maven-release-plugin, it will automatically use the central-publishing-maven-plugin to do the upload. I'm sure that was all probably obvious to Maven experts, but the whole reason I was using the maven-release-plugin was that I wasn't a Maven expert so I was unclear on how to cobble together all the necessary plugins together properly in Maven. So that's great. If you're using the maven-release-plugin, then migrating to the new Central Portal simply involves adding a new plugin to your Maven build.
No comments:
Post a Comment