<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<profiles>
...
<profile>
<id>oss.sonatype.org</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>YourGpgKeyPasswordHere</gpg.passphrase>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>oss.sonatype.org</id>
<username>[email protected]</username>
<password>yourPasswordHere</password>
</server>
</servers>
</settings>
Mind the gpg
executable, if you installed gnupg / gnupg2 via brew install gnupg gnupg2
- otherwise it will not find gpg2
for example.
Then mind your pom.xml
:
<profiles>
<!-- plugins needed to deploy to Maven Central -->
<profile>
<id>central-deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
The gpgArguments
configuration with --pinentry-mode
and loopback
is needed to prevent you from the following error (see this so answer):
gpg: signing failed: Inappropriate ioctl for device
mvn versions:set "-DnewVersion=2.2.1.RELEASE"
# or a beta, alpha, Milestone version like the following (SNAPSHOTS don't work, or at least I always got a nexus-staging-maven-plugin:1.6.8:release (deploy-to-sonatype) on project cxf-spring-boot-starter-maven-plugin: The staging repository to operate against is not defined! (use "-DstagingRepositoryId=foo1,foo2" on CLI))
mvn versions:set "-DnewVersion=2.3.1-jaxb-jaxws-3.0.0-M4"
# use the pw for encryption, that is defined inside the .m2/settings.xml
mvn clean deploy -P central-deploy
### Release only submodules or/and reactor
If you want to release only sub-modules and the reactor parent, seehttps://stackoverflow.com/questions/1114026/maven-modules-building-a-single-specific-module & https://stackoverflow.com/questions/9500480/install-parent-pom-without-building-child-modules
### submodule(s) only (separate with , for multiple)
mvn clean deploy -P central-deploy --projects cxf-spring-boot-starter-maven-plugin
### reactor only
mvn clean deploy -P central-deploy --non-recursive
# last step: set next development version beforce pushing
mvn versions:set "-DnewVersion=2.2.2-SNAPSHOT"