maven deploy适用于快照,但404适用于版本

dced5bon  于 2023-03-01  发布在  Maven
关注(0)|答案(3)|浏览(165)

我正在尝试部署到我们的内部nexus仓库,我已经配置了一个maven项目,在那里我可以做mvn 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>

当我将<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

它们都可在Nexus中使用:

我尝试添加不同的插件,但没有运气。我不是一个内行Maven,所以任何帮助将不胜感激!

zkure5ic

zkure5ic1#

当我使用Steve C的答案时,maven停止了部署,而我传递了-DskipStaging=true,如本文所述,这使我能够继续使用nexus-staging-maven-plugin,只是没有登台功能。

jm2pwxwz

jm2pwxwz2#

您无法部署分阶段发布,因为您现在使用的是Nexus社区版,它不支持此功能。
现在,您需要从pom.xml中删除nexus-staging-maven-plugin配置和常规

mvn clean deploy

将“正常工作”(但没有分期)。

2izufjch

2izufjch3#

我遇到了同样的问题,这一个为我工作。

mvn clean install deploy -DskipStaging=true

相关问题