【发布时间】:2013-12-02 06:42:37
【问题描述】:
很长一段时间以来,我都有一个 Jenkins 构建,它执行 Sonar 作为构建后操作。它多年来一直运行良好,然后上周开始失败:
Downloading: http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/sonar-maven-plugin-2.2-SNAPSHOT.pom
Downloading: http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/sonar-maven-plugin-2.2-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:sonar-maven-plugin:maven-plugin:2.2-SNAPSHOT' in repository central (http://central)
[INFO] Cannot find mojo descriptor for: 'sonar:sonar' - Treating as non-aggregator.
[INFO] ------------------------------------------------------------------------
[INFO] Building portal
[INFO] task-segment: [sonar:sonar]
[INFO] ------------------------------------------------------------------------
Downloading: http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/sonar-maven-plugin-2.2-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:sonar-maven-plugin:maven-plugin:2.2-SNAPSHOT' in repository central (http://central)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
...
我有一个我认为是相当标准的设置,我们的 Nexus 上有一个公共存储库,它共享 Nexus 中其他存储库的所有内容,例如 OOTB Codehaus Snapshots 存储库。 (是的,我已经四次检查 Codehaus Snapshots 存储库是否在公共存储库的有序组存储库中。)
我并不完全了解快照的工作原理,但我的印象是 maven-metadata.xml 文件告诉客户端哪些版本的快照可供下载。
如果我使用浏览器并直接访问 codehaus-snapshots 存储库,我会得到带有版本信息的 maven-metadata.xml:
http://myNexusServer/nexus/service/local/repositories/codehaus-snapshots/content/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml
<metadata modelVersion="1.1.0">
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20131108.154049</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20131108154049</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>2.2-20131108.154049-1</value>
<updated>20131108154049</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>2.2-20131108.154049-1</value>
<updated>20131108154049</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
如果我尝试从公共 repo 加载它,则找不到:
http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml
The server has not found anything matching the request URI
如果我将 ?describe 添加到公共 repo 的请求中,我会得到:
{ "data" : { "processingTimeMillis" : 108,
"request" : { "requestContext" : [ "request.received.timestamp=1384808412437",
"request.address=my.ip.addy",
"request.remoteOnly=false",
"request.url=http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml?describe",
"request.localOnly=false",
"request.appRootUrl=http://myNexusServer/nexus"
],
"requestPath" : "/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml",
"requestUrl" : "http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml?describe"
},
"requestUrl" : "http://myNexusServer/nexus/content/groups/public/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT/maven-metadata.xml?describe",
"response" : { "appliedMappings" : [ "public repository applied []" ],
"processedRepositoriesList" : [ "public",
"releases",
"snapshots",
"thirdparty",
"central",
"java.net-m2",
"java.net-m1-m2",
"google",
"apache-snapshots",
"codehaus-snapshots",
"sonatype.public",
"com.springsource.repository.bundles.release",
"sonar.repo",
"com.springsource.repository.bundles.external"
],
"responseType" : "NOT_FOUND"
}
}
}
当我尝试构建 sonar:sonar 时,我在 .m2/repository/org/codehaus/mojo/sonar-maven-plugin/2.2-SNAPSHOT 中得到一个 maven-metadata-central.xml,但它缺少版本信息:
<metadata>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
</metadata>
所以我认为问题在于公共 repo 没有向客户端提供带有版本信息的 maven-metadata.xml,因此客户端尝试在没有版本信息的情况下下载它,并在找不到时失败它。我说的对吗?
我需要对我的 Nexus(或者可能是 Jenkins)的配置进行哪些更改才能使其再次正常工作?
【问题讨论】:
标签: maven jenkins sonarqube nexus