Search code examples
mavennexus3

maven deploy works with snapshots but 404 for releases


I am trying to deploy to our internal nexus repository. I have configured a maven project where I can do a mvn install and mvn clean deploy. The odd thing is when I remove SNAPSHOT from the version, I get a 404.

Here is my pom.xml that works for SNAPSHOTS:

<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>MavenExample</groupId>
  <artifactId>com.mycompany</artifactId>
  <version>1.0-SNAPSHOT</version>

  <distributionManagement>
    <repository>
      <id>nexus</id>
      <url>http://nexus.mycompany.com:8000/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
      <id>nexus</id>
      <url>http://nexus.mycompany.com:8000/repository/maven-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.3</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>nexus</serverId>
          <nexusUrl>http://nexus.mycompany.com:8000/repository/maven-releases/</nexusUrl>
          <!-- update this to the correct id! -->
          <stagingProfileId>myid</stagingProfileId>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

When I change <version>1.0-SNAPSHOT</version> to <version>1.0</version>

I Get this error:

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.3:deploy (injected-nexus-deploy) on project explicit-staging-example: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.3:deploy failed: Nexus connection problem to URL [http://nexus.mycompany.com:8000/repository/maven-releases/ ]: 404 - Not Found -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

They are both available in nexus:

maven

I have tried adding different plugins but no luck. I'm not a maven expert so any help would be greatly appreciated!


Solution

  • You are not able to deploy staged releases because you're using the community edition of Nexus right now, and it does not support this functionality.

    For now you need to remove the nexus-staging-maven-plugin configuration from your pom.xml and the regular

    mvn clean deploy
    

    will "just work" (but without staging).