Maven 部署适用于快照,但发布时为 404

Chr*_*ton 4 maven nexus3

我正在尝试部署到我们的内部关系存储库。我已经配置了一个 Maven 项目,我可以在其中执行 amvn installmvn clean deploy. 奇怪的是,当我SNAPSHOT从版本中删除时,我得到了一个404.

这是我的 pom.xml 适用于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>
Run Code Online (Sandbox Code Playgroud)

当我更改<version>1.0-SNAPSHOT</version><version>1.0</version>

我收到此错误:

[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
Run Code Online (Sandbox Code Playgroud)

它们都可以在连接中使用:

行家

我尝试过添加不同的插件,但没有成功。我不是 Maven 专家,因此任何帮助将不胜感激!

maj*_*man 6

当我使用 Steve C 的答案时,maven 就停止了部署。我反而通过了-DskipStaging=true,如此处记录。这使我能够继续使用nexus-staging-maven-plugin,只是没有暂存功能。