maven-release-plugin + nexus-staging-plugin + Maven 2.2.1 Server Credentials with ID not found

Symptoms

You are:

  • using Maven 2.2.1
  • using maven-release-plugin ( release:prepare release:perform )
  • using nexus-staging-plugin as part of release process
  • specifying additional configuration in your settings.xml server section, like a different wagon provider or http params

When executing mvn release:prepare release:perform , your build fails during deploy execution in the release:perform build step because it cannot find your server id credentials that match your nexus-staging-plugin serverID parameter.

Example failure:

[INFO] [INFO] ------------------------------------------------------------------------ 
[INFO] [ERROR] BUILD ERROR 
[INFO] [INFO] ------------------------------------------------------------------------ 
[INFO] [INFO] Server credentials with ID "mynexus" not found! 
[INFO] [INFO] ------------------------------------------------------------------------

Workaround 1 ( Preferred )

Use Maven 3.0.4+ instead of Maven 2.2.1 - it just works.

Workaround 2

If you must Maven 2.2.1 ( please avoid this if possible ):

1.) Comment out/delete your server configuration in your settings.xml

<server> 
      <username>admin</username> 
      <password>admin123</password> 
      <!--
      <configuration> 
any configuration here will cause the server id to not be found </configuration> --> <id>mynexus</id> </server>

2.) (Optional) Modify your release plugin configuration to use 'httpclient' provider via a system property if you want to override the wagon provider

Example:

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>...</version>
          <configuration>
            ...
            <arguments>-Dmaven.wagon.provider.http=httpclient</arguments>
          </configuration>
        </plugin>

3) (Optional) Use our recommended version of wagon-http 2.1 by specifying the extension in your pom.xml if you want to override the wagon provider

<build>
...
   <extensions>

     <!-- Maven 2.2.1 should use this Wagon version -->
     <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-http</artifactId>
        <version>2.1</version>
      </extension>

    </extensions>
...
  </build>

It seems that any configuration in the server section of a settings.xml could trigger the same server id not found problem with Maven 2.2.1.

Please weigh the benefit of using Maven 2.2.1 seriously. It is no longer being developed. Maven 3.0.4 has proven very stable.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk