【发布时间】:2014-10-21 12:51:49
【问题描述】:
我有一个构建服务器,它将所有 maven 依赖项查找镜像到本地 sonatype 关系。最近 Maven 没有查找依赖项,我不明白为什么。
在构建服务器的 .m2/settings.xml 中,我有以下镜像设置。
<mirrors>
<mirror>
<id>nexus</id>
<url>http://my-host/nexus/content/groups/public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
使用 -X 开关构建项目我得到以下输出
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: my.group:my.artifact:1.4.2-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [compile, runtime, test]
[DEBUG] Repositories (dependencies): [nexus (http://my-host/nexus/content/groups/public, releases)]
[DEBUG] Repositories (plugins) : [nexus (http://my-host/nexus/content/groups/public, releases)]
[DEBUG] =======================================================================
[DEBUG] Could not find metadata my.group:my.artifact-2:1.5.1-SNAPSHOT/maven-metadata.xml in local (/usr/local/jenkins/.m2/repository)
[DEBUG] Could not find metadata my.group:my.artifact-2:1.5.1-SNAPSHOT/maven-metadata.xml in local (/usr/local/jenkins/.m2/repository)
[WARNING] The POM for my.group:my.artifact-2:jar:1.5.1-SNAPSHOT is missing, no dependency information available
[DEBUG] my.group:my.artifact:jar:1.4.2-SNAPSHOT
[DEBUG] my.group:yyyyy:jar:1.3.0-SNAPSHOT:compile
[DEBUG] my.group:xxxx:jar:1.3.0-SNAPSHOT:compile
[DEBUG] com.oracle:oracle-driver:jar:11.1:compile
[DEBUG] my.group:my.artifact-2:jar:1.5.1-SNAPSHOT:compile
[DEBUG] my.group:zzzzz:jar:1.0.2-SNAPSHOT:compile
[DEBUG] javax.servlet:servlet-api:jar:2.3:compile
[DEBUG] taglibs:standard:jar:1.1.2:compile
[DEBUG] log4j:log4j:jar:1.2.14:compile
[DEBUG] org.mockito:mockito-all:jar:1.9.5:test
[DEBUG] org.hamcrest:hamcrest-all:jar:1.3:test
[DEBUG] junit:junit:jar:4.10:test
[DEBUG] org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
浏览 Nexus 界面,我可以在其中看到 my.group:my.artifact-2:1.5.1-SNAPSHOT 工件。在构建服务器中,文件夹 /repository/my.group/my.artifact 不存在。
【问题讨论】:
-
检查 pom.xml 中的
<repositories>部分。我认为您的存储库仅用于发布,而不是快照。 -
添加
<repositories>解决了这个问题
标签: maven