使用maven 3.0.5将快照发布到nexus

hYk*_*hYk 10 nexus maven-3 maven

我无法发布使用maven到nexus构建的工件的快照版本.我的工件版本声明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]
Run Code Online (Sandbox Code Playgroud)

根据我能够发现的是,maven3在我想要部署的工件上添加了时间戳而不是SNAPSHOT后缀.<uniqueVersion>maven3不支持maven 的标记.使用mvn deploy命令部署这些工件需要采取哪些方法.

更新: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>
Run Code Online (Sandbox Code Playgroud)

的settings.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>
Run Code Online (Sandbox Code Playgroud)

JF *_*ier 9

通常,您的nexus具有单独的存储库"快照"和"发布".SNAPSHOT版本部署到前者,非SNAPSHOT版本到后者.对于部署,必须由您指定这些存储库.您可以通过将distributionManagement部分添加到您的pom来完成此操作.在那里,您可以为两个目标定义特定目标.

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