maven deploy适用于快照,但404适用于发行版

时间:2017-05-03 15:23:17

标签: maven nexus3

我正在尝试部署到我们的内部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

我尝试添加不同的插件但没有运气。我不是专家,所以任何帮助都会非常感激!

3 个答案:

答案 0 :(得分:2)

您无法部署暂存版本,因为您现在正在使用Nexus的社区版,并且它不支持此功能。

现在您需要从pom.xml和常规

中删除public void fillHashMap() { lela_database = FirebaseDatabase.getInstance().getReference(); lela_database.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { HashMap languages_in = new HashMap(); for (DataSnapshot lan : dataSnapshot.child("languages").getChildren()) { languages_in.put(lan.getKey(), lan.getValue()); } languages = languages_in; } @Override public void onCancelled(DatabaseError databaseError) { Log.i(TAG,"onCancelled called "); } }); } 配置
nexus-staging-maven-plugin

将&#34;只是工作&#34; (但没有分期)。

答案 1 :(得分:1)

当我使用Steve C的答案时,maven刚刚停止部署。我改为通过here中记录的-DskipStaging=true。这使我可以继续使用nexus-staging-maven-plugin,而没有暂存功能。

答案 2 :(得分:0)

我遇到了同样的问题,这个问题对我有用。

MVN全新安装部署-DskipStaging = true