本文介绍了Maven没有使用repo1,它将转到maven.glassfish.org并导致我的构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此回购部分:

<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.netmaven.glassfish.org?它不在我的肚子里

Why is maven continuously going to download.java.net and maven.glassfish.org ? It's not in my poms anywhere

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感到不满意...我不知道发生了什么,但是此构建曾经有效.

As a debug step, I've nuked ~/.m2... I don't know what is going on, but this build used to work.

MOR

好,所以我应该提到,存储库部分位于父pom中,而依赖项位于子pom中.如果将配置放入一个大pom中,它将起作用.两个小球,它失败了.什么鬼?

Ok, so I should have mentioned, the repositories section is in the parent pom and the dependency is in the child pom. If I put the configuration into one big pom it works. Two poms, it fails. What the heck??

甚至MOR

这真是太疯狂了,因为Maven正在获得额外的存储库,我什至检查了人工制品poms.无论如何,这是我对无法解释的行为的解决方案.将其放在我的settings.xml中:

This is absolutely crazy where maven is getting the extra repositories at, I even checked the artifact poms. Anyway, here is my solution to the unexplained behavior. Put this in my settings.xml:

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

这迫使Maven使用Central,但当我使用eclipselink存储库时除外.叹气,啊!

This forces maven to use central, except for when I'm using the eclipselink repo. Sigh, argh!

推荐答案

这真是疯了,因为Maven在那里获得了额外的存储库,我什至还检查了人工产物poms.无论如何,这是我对无法解释的行为的解决方案.将其放在我的settings.xml中:

This is absolutely crazy where maven is getting the extra repositories at, I even checked the artifact poms. Anyway, here is my solution to the unexplained behavior. Put this in my settings.xml:

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

这迫使Maven使用Central,但当我使用eclipselink存储库时除外.这并不能回答我的问题,但这是由于Maven与这些外部存储库联系的任何疯狂原因而解决的方法.

This forces maven to use central, except for when I'm using the eclipselink repo. This doesn't answer my question, but it's a workaround for whatever crazy reason maven is contacting these external repos.

这篇关于Maven没有使用repo1,它将转到maven.glassfish.org并导致我的构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 11:37