3

我有这个回购部分:

<repositories>
    <repository>
        <id>Repo1</id>
        <url>http://repo1.maven.org/maven2</url>
        <releases>
            <enabled>true</enabled>
            <checksumPolicy>fail</checksumPolicy>
        </releases>
    </repository>
    <repository>
        <id>EclipseLink</id>
        <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
    </repository>
</repositories>

和这个依赖:

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.9.1</version>
        <scope>compile</scope>
    </dependency>

为什么 Maven 不断地去download.java.netand maven.glassfish.org?它不在我的任何地方

Downloading: http://download.java.net/maven/glassfish//com/ocpsoft/prettyfaces-parent/3.3.3/prettyfaces-parent-3.3.3.pom
[INFO] Unable to find resource 'com.ocpsoft:prettyfaces-parent:pom:3.3.3' in repository Glassfish (http://download.java.net/maven/glassfish/)
Downloading: http://repo1.maven.org/maven2/com/ocpsoft/prettyfaces-parent/3.3.3/prettyfaces-parent-3.3.3.pom
8K downloaded  (prettyfaces-parent-3.3.3.pom)
Downloading: http://download.java.net/maven/glassfish//com/ocpsoft/ocpsoft-parent/2/ocpsoft-parent-2.pom
[INFO] Unable to find resource 'com.ocpsoft:ocpsoft-parent:pom:2' in repository Glassfish (http://download.java.net/maven/glassfish/)
Downloading: http://repo1.maven.org/maven2/com/ocpsoft/ocpsoft-parent/2/ocpsoft-parent-2.pom
1K downloaded  (ocpsoft-parent-2.pom)
Downloading: http://repo1.maven.org/maven2/com/sun/jersey/jersey-client/1.9.1/jersey-client-1.9.1.pom
6K downloaded  (jersey-client-1.9.1.pom)
Downloading: http://repo1.maven.org/maven2/com/sun/jersey/jersey-project/1.9.1/jersey-project-1.9.1.pom
17K downloaded  (jersey-project-1.9.1.pom)
Downloading: http://download.java.net/maven/2/net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository m2.java.net (http://download.java.net/maven/2)
Downloading: http://repository.jboss.org/nexus/content/groups/public//net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository repository.jboss.org (http://repository.jboss.org/nexus/content/groups/public/)
Downloading: http://maven.glassfish.org/content/groups/glassfish/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded  (jvnet-parent-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/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded  (jvnet-parent-1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - IGNORING
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: com.sun.jersey:jersey-project:pom:1.9.1

Reason: Cannot find parent: net.java:jvnet-parent for project: com.sun.jersey:jersey-project:pom:1.9.1 for project com.sun.jersey:jersey-project:pom:1.9.1

编辑:

作为调试步骤,我已经破坏了〜/ .m2 ...我不知道发生了什么,但是这个构建曾经可以工作。

铁道部编辑:

好的,所以我应该提到,存储库部分在父 pom 中,而依赖项在子 pom 中。如果我将配置放入一个大 pom 中,它就可以工作。两个pom,它失败了。有没有搞错??

甚至更多编辑:

在 maven 获得额外存储库的地方,这绝对是疯狂的,我什至检查了工件 pom。无论如何,这是我对无法解释的行为的解决方案。把它放在我的 settings.xml 中:

<settings>
  <mirrors>
    <mirror>
      <id>central-mirror</id>
      <url>http://repo.maven.apache.org/maven2</url>
      <mirrorOf>*,!eclipselink</mirrorOf>
    </mirror>
  </mirrors>
</settings>

这迫使 maven 使用中央,除了当我使用 eclipselink repo 时。叹息,啊!

4

2 回答 2

2

在 maven 获得额外存储库的地方,这绝对是疯狂的,我什至检查了工件 pom。无论如何,这是我对无法解释的行为的解决方案。把它放在我的 settings.xml 中:

<settings>
  <mirrors>
    <mirror>
      <id>central-mirror</id>
      <url>http://repo.maven.apache.org/maven2</url>
      <mirrorOf>*,!eclipselink</mirrorOf>
    </mirror>
  </mirrors>
</settings>

这迫使 maven 使用中央,除了当我使用 eclipselink repo 时。这并不能回答我的问题,但无论出于何种疯狂原因,maven 都可以联系这些外部存储库,这是一种解决方法。

于 2013-04-19T18:18:18.073 回答
0

也可以在您的 settings.xml 和其他依赖项的 pom 中指定存储库。无论您直接或间接命名哪些存储库,maven 都不保证这些存储库的搜索顺序,如果 maven 碰巧在一个存储库中找到了错误的工件,它会失败(显然)并且不会尝试任何其他存储库。

如果您可以找到给您带来麻烦的工件的好版本,您可以尝试手动将该工件放置在本地 .m2 存储库中。

于 2013-04-18T21:51:53.633 回答