Maven 2.2.1存储库顺序似乎是随意的

时间:2012-04-09 15:41:46

标签: java maven

我的构建在新机器上打破,因为其中一个存储库为pom和jar而不是预期的404返回301页。依赖项是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?

1 个答案:

答案 0 :(得分:0)

我可以提出的第一个建议是阅读sonatype article about repositories in your pom。此外http code 301 means in move permanently。这意味着您用于其中一个存储库的URL似乎已过期或应该不同。 定义的glassfish repository seemed to wrong,因为它应该是https连接。

我可以向use a repository manager推荐。

我想到了一个问题:为什么要在您的存储库列表中定义Maven Central,因为它已经在Maven中定义了...... BTW:存储库定义应该放在settings.xml而不是pom.xml中从使用存储库管理器。

要定义存储库访问的顺序,请在reverse order based on their definition in the settings.xml中完成。要更好地控制它,请使用存储库管理器。

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

相关问题