【问题标题】:public nexus group repo not providing version info from snapshot proxy repo公共关系组回购不提供来自快照代理回购的版本信息
【发布时间】: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


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      虽然我仍然不了解 Nexus 的一些问题等,但我的构建已经重新开始工作,我不想让它保持开放状态。

      最初我想我错过了输出的这一部分:

      [INFO] Searching repository for plugin with prefix: 'sonar'.
      [INFO] org.apache.maven.plugins: checking for updates from central
      [INFO] org.codehaus.mojo: checking for updates from central
      [INFO] artifact org.codehaus.mojo:sonar-maven-plugin: checking for updates from central
      [INFO] Ignoring available plugin update: 2.2 as it requires Maven version 3.0
      

      这让我想知道是什么指定了要使用的声纳版本。我搜索了我所有的 POM,但没有一个真正列出声纳插件。所以我将此添加到父 pom.xml 的插件部分:

      <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>1.0</version>
      </plugin>
      

      ...构建再次开始工作。我不知道 maven 在以前工作时从哪里获得声纳依赖项(如果它从未工作过,这对我来说很有意义),但我想我将不得不忍受这个谜。

      【讨论】:

        【解决方案3】:

        为了解决该问题,我在 Hudson 配置中所做的更改是 Sonar installations 部分中的 Version of sonar-maven-plugin。我尝试了2.02.6 版本,如果您使用Maven 3.0,它们都可以工作。

        Hudson 的 Sonar 插件似乎默认使用 2.2-SNAPSHOT 可用的 here。要添加我尝试的工件:

        1. 在我的 Nexus 中添加 nexus.codehaus.org 作为代理存储库
        2. 手动上传工件
        3. 手动将工件上传到具有不同版本的第二个 Nexus,因为第一个导致元数据损坏

        在所有情况下,我都无法获得用于声纳分析的 2.2-SNAPSHOT 工件。相反,它适用于其他版本。

        【讨论】:

          猜你喜欢
          • 2011-07-11
          • 2021-03-29
          • 2011-05-21
          • 1970-01-01
          • 2022-01-16
          • 1970-01-01
          • 1970-01-01
          • 2011-03-03
          • 2015-10-13
          相关资源
          最近更新 更多