It feels really good to see the locally built and signed artifacts on maven central and it’s not a big problem to get this work ….. if you know how 😉
The main issues are to define scm and distributionManagement inside pom.xml so it’s easy to build and release via maven-release-plugin and to sign them (previously created gpg keypair needed) using maven-gpg-plugin.
There is no need to define maven-gpg-plugin inside your pom but it’s important that you use oss-sonatype’s parent pom.
To release a new version of the project all I have to do is t call
mvn release:prepare -Darguments=”-Dgpg.keyname=C156CAD5 -Dgpg.passphrase=\”myGpgPassphrase\””
mvn release:perform -Darguments=”-Dgpg.keyname=C156CAD5 -Dgpg.passphrase=\”myGpgPassphrase\” -Psonatype-oss-release”
release:perform automatically uploads the artifacts to the staging repository oss.sonatype.org, the credentials have to be defined inside ~/.m2/settings.xml
A great step-by-step documentation can be found here.
PS: The pom.xml can be found here
PPS: The released project is durationformatter