Jonathan S. Fisher
Jonathan S. Fisher

Reputation: 8876

Maven is not using repo1, it's going over to maven.glassfish.org and failing my build

I have this repo section:

<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>

and this dependency:

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

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

EDIT:

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

MOR EDIT:

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??

EVEN MOR EDIT:

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>

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

Upvotes: 3

Views: 2172

Answers (2)

Jonathan S. Fisher
Jonathan S. Fisher

Reputation: 8876

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>

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.

Upvotes: 2

Chris Gerken
Chris Gerken

Reputation: 16392

Repositories can also be specified in your settings.xml and other dependencies' poms. Regardless of which repositories you do directly or indirectly name, maven doesn't guaranty the search order for those repositories, If maven happems to find a bad artifact in one repository, it fails (obviously) and doesn't try any other repositories.

If you can find a good version of the artifact that's giving you trouble, you might try manually placing that artifact in your local .m2 repository.

Upvotes: 0

Related Questions