【发布时间】:2018-03-18 08:03:46
【问题描述】:
我正在使用 maven 3 和 nexus 将我们的工件部署到存储库,
我看到在 maven 3 中不推荐使用非唯一选项,因此所有 SNAPSHOTS 工件都使用时间戳进行部署,我对此很满意,问题是看起来所有工件都不在我指定的版本之下( 0.6-SNAPSHOT),所以当我尝试获取此依赖项时,构建失败,因为它找不到它。
这是 pom 中的依赖定义:
<dependency>
<groupId>com.globals</groupId>
<artifactId>globals-general</artifactId>
<version>0.6-SNAPSHO</version>
</dependency>
这是我在尝试获取依赖项时遇到的错误:
Failed to execute goal on project mprest-mgrid-infra-cache: Could not resolve dependencies for project com.mprest.mgrid.infra:mprest-mgrid-infra-cache:jar:0.6-SNAPSHOT: Could not find artifact com.mprest.mgrid.globals:mprest-mgrid-globals-general:jar:0.6-SNAPSHOT ->
这是我的 pom 相关部分:
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://nexus:8081/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://nexus:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
这是结构:
【问题讨论】:
-
我认为您的操作没有错误。 Maven 将 0.6-SNAPSHOT 作为某个时间戳部署到 Nexus,如果您声明对 0.6-SNAPSHOT 的依赖,则应加载最新的时间戳。尝试向我们提供有关您所做工作的更多信息。
-
distributionManagement 与使用工件无关。这应该在您的
settings.xml中配置并指向 Nexus 中的存储库组... -
在settings.xml中也配置了distributionManagement