I have a maven project that was published via OSSRH Sonatype. This had to be migrated to Central Publisher Portal. I followed the procedure described here and here.
The publishing procedure I used to follow was:
mvn clean install -Dskip=false
mvn clean release:prepare -Dskip=false --batch-mode
mvn clean release:perform -Dskip=false
But now and since migration, with my .m2/settings.xml
being
<servers>
<server>
<id>central</id>
<username>mycentralusername</username>
<password>mycentralpassword</password>
</server>
</servers>
and having added this to my pom.xml
:
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
I get the following error during the last step (mvn relase:perform
):
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy (injected-nexus-deploy) on project (...):
Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy failed:
Server credentials with ID "ossrh" not found!
Why does maven still try to connect to ossrh server? Where does the configuration of mvn release:perform
lie, and where can I change this to look for central server?
Thanks to this comment I found out there was indeed this configuration:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
but it was located in the parent pom.xml
.
Everything works as intended now.