我无法发布使用 maven to nexus 构建的 Artifact 的快照版本。我的 Artifact 的版本为 1.0.0-SNAPSHOT。
我可以执行mvn clean install
没有问题。但是当我尝试使用 mvn deploy
进行部署时,我收到以下错误:
Return code is: 400, ReasonPhrase: Repository version policy: RELEASE does not allow version: 1.0.0-20161019.214318-1. -> [Help 1]
据我所知,maven3 在我想要部署的 Artifact 上添加了时间戳而不是 SNAPSHOT 后缀。 <uniqueVersion>
maven3不支持maven的tag。我需要采取什么方法来使用 mvn deploy
部署这些 Artifact 命令。
更新: pom.xml
<distributionManagement>
<repository>
<id>my-nexus-snapshots</id>
<name>Internal Snapshot Releases</name>
<url>http://localhost:9999/repository/maven-snapshots/</url>
</repository>
<snapshotRepository>
<id>my-nexus-releases</id>
<name>Internal Releases</name>
<url>http://localhost:9999/repository/maven-releases/</url>
</snapshotRepository>
</distributionManagement>
设置.xml
<server>
<id>my-nexus-snapshots</id>
<username>user</username>
<password>user123</password>
</server>
<server>
<id>my-nexus-releases</id>
<username>user</username>
<password>user123</password>
</server>
最佳答案
通常,您的连接有单独的存储库“快照”和“版本”。 SNAPSHOT 版本部署到前者,非SNAPSHOT 版本部署到后者。对于部署,您必须指定这些存储库。您可以通过将 distributionManagement 部分添加到 pom.xml 来完成此操作。您可以在此处为这两个目标定义特定目标。
<distributionManagement>
<repository>
<id>releases</id>
<name>releases</name>
<url>http://somerepo:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshots</name>
<url>http://somerepo:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
关于maven - 使用maven 3.0.5发布快照到nexus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40142162/