maven - 使用maven 3.0.5发布快照到nexus

标签 maven maven-3 nexus

我无法发布使用 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/

相关文章:

java - m2eclipse 无法从中央仓库更新索引

java - 如何解决 "weblogic.application.ModuleException: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer"错误

maven - tycho-p2-repository-plugin 失败,错误为 "No content specified for p2 repository"

google-app-engine - 如何根据正在执行的目标激活配置文件

grails - 通过 ivy 从本地 nexus 存储库中提取 oracle jdbc 驱动程序-> 尝试访问外部源?

java - 无法解析 Spring Boot 应用程序中的符号 "security"

java - Maven 表达式解决问题

java - 在项目上执行 sonarQube 的问题由 : java. lang.UnsupportedClassVersionError: org/sonarsource/scanner/maven/SonarQubeMojo 引起

maven - 如何让 Nexus 获取代理存储库中的 Artifact 文件?

kubernetes - 在 Kubernetes 集群中使用 Docker 运行 Nexus 3