1

我的构建在一台新机器上中断,因为其中一个存储库为 pom 和 jar 返回 301 页面,而不是预期的 404。依赖项是 asm:asm:1.3。它在中央,但 Maven 似乎并没有在那儿寻找。

这是构建日志的示例:

Downloading: http://download.java.net/maven/2/asm/asm/3.1/asm-3.1.pom
[INFO] Unable to find resource 'asm:asm:pom:3.1' in repository java.net2 (http://download.java.net/maven/2)
Downloading: http://repository.primefaces.org/asm/asm/3.1/asm-3.1.pom
[INFO] Unable to find resource 'asm:asm:pom:3.1' in repository prime-repo (http://repository.primefaces.org)
Downloading: https://repository.jboss.org/nexus/content/groups/public-jboss//asm/asm/3.1/asm-3.1.pom
[INFO] Unable to find resource 'asm:asm:pom:3.1' in repository jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public-jboss/)
Downloading: http://maven.thebuzzmedia.com/asm/asm/3.1/asm-3.1.pom
[INFO] Unable to find resource 'asm:asm:pom:3.1' in repository The Buzz Media Maven Repository (http://maven.thebuzzmedia.com)
Downloading: http://maven.glassfish.org/content/groups/glassfish/asm/asm/3.1/asm-3.1.pom
185b downloaded  (asm-3.1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://maven.glassfish.org/content/groups/glassfish/asm/asm/3.1/asm-3.1.pom
185b downloaded  (asm-3.1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - IGNORING
[WARNING] POM for 'asm:asm:pom:3.1:compile' is invalid.

这是我的 pom.xml 中的存储库部分:

<repositories>
    <repository>
        <id>central</id>
        <name>Central Maven Repository</name>
        <url>http://repo1.maven.org/maven2</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>java.net2</id>
        <name>Repository hosting the jee6 artifacts</name>
        <url>http://download.java.net/maven/2</url>
    </repository>
    <repository>
        <id>prime-repo</id>
        <name>Prime Technology Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>
    <repository>
        <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
        <id>jboss-public-repository-group</id>
        <layout>default</layout>
        <name>JBoss Public Maven Repository Group</name>
    </repository>
    <repository>
        <id>The Buzz Media Maven Repository</id>
        <url>http://maven.thebuzzmedia.com</url>
    </repository>
</repositories>

我没有 settings.xml 文件。

据我所知,对 jersey-server-1.3 的依赖正在破坏构建。它的 pom.xml 指定了现在不存在的存储库http://maven.glassfish.org/content/groups/glassfish。但是我指定的所有其他存储库都按照我指定的顺序进行检查。也就是说,除了中央之外的所有东西。如何让 Maven 先检查中央存储库?或者至少在使用依赖项的 poms 中指定的存储库之前检查 Central?

4

1 回答 1

0

我可以提出的第一个建议是阅读关于 pom 中存储库的 sonatype 文章。此外,http 代码 301 意味着永久移动。这意味着您用于存储库之一的 URL 似乎已过时或应该不同。定义的glassfish 存储库似乎是错误的,因为它应该是一个 https 连接。

此外,我可以推荐使用存储库管理器

我想到了一个问题:为什么要在存储库列表中定义 Maven Central,因为它已经在 Maven 本身中定义了......顺便说一句:除了使用存储库管理器。

要定义存储库访问的顺序,请根据它们在 settings.xml 中的定义以相反的顺序完成。为了更好地控制这一点,请使用存储库管理器。

一个重要的问题:为什么不使用 Maven 3.0.X 而不是 Maven 2.2.1 ?

于 2012-04-09T16:44:59.610 回答