Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven deploy works with snapshots but 404 for releases

Tags:

maven

nexus3

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!

like image 728
Chris Bolton Avatar asked Oct 17 '25 16:10

Chris Bolton


1 Answers

When I used Steve C's answer, maven just stopped deploying. I instead passed -DskipStaging=true, as documented here. This allowed me to keep using the nexus-staging-maven-plugin, just without the staging capability.

like image 99
chizou Avatar answered Oct 19 '25 13:10

chizou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!