Maven resolved commons-collections groupid as org.apache.commons.collections and can't find version 3.2.1

seba.wagner picture seba.wagner · Sep 4, 2014 · Viewed 8.5k times · Source

in my pom I have a dependency:

<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.1</version>
</dependency>

IMHO This is the correct dependency (compare http://mvnrepository.com/artifact/commons-collections/commons-collections/3.2.1).

However when Maven tries to resolve this, the URLs it trying for are:

Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo1.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
[WARNING] The POM for org.apache.commons:commons-collections:jar:3.2.1 is missing, no dependency information available
Downloading: http://almvn.solnetsolutions.co.nz/content/groups/public/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://almvn.solnetsolutions.co.nz/content/repositories/releases/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo1.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar

Those all fail, as (IMHO) it is the wrong group id (org/apache/commons). Where does it get the "org/apache/commons" in the URL path from ?

I have no other dependency that would even mention org.apache in the group id.

Where does Maven get this URL from ?

It is just so wrong, why can't it resolve it correctly to: http://central.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

?

My Maven setup is:

Apache Maven 3.0.4 (r1232337; 2012-01-17 21:44:56+1300)
Maven home: /home/solnet/apache-maven-3.0.4
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: /home/solnet/jdk1.7.0_11/jre
Default locale: en_NZ, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.2.1.el6.x86_64", arch: "amd64", family: "unix"

This is my repository setup in the pom file:

    <repositories>

        <repository>
            <id>mvnrepo</id>
            <name>mvnrepo</name>
            <url>http://mvnrepository.com</url>
        </repository>

         <repository>
            <id>centralmvn</id>
            <name>centralmvn</name>
            <url>http://central.maven.org</url>
        </repository>
        <repository>
            <id>mvnrepo2</id>
            <name>mvnrepo2</name>
            <url>http://repo1.maven.org</url>
        </repository>
        <repository>
            <id>oss-sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>codehaus-snaphosts</id>
            <name>Codehaus Snapshots</name>
            <url>http://snapshots.repository.codehaus.org/</url>
        </repository>
        <repository>
            <id>codehaus-releases</id>
            <name>CodeHaus Releases</name>
            <url>http://repository.codehaus.org/</url>
        </repository>

   /repositories>

And this is the output of "mvn help:effective-pom" ... too big for stackoverflow so see: http://pastebin.com/RHAkUmMu

And this is the output of

mvn dependency:tree -Dincludes="org.apache.commons:commons-collections"

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mobilewebapp 1.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://almvn.solnetsolutions.co.nz/content/groups/public/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
Downloading: http://almvn.solnetsolutions.co.nz/content/repositories/releases/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.pom
[WARNING] The POM for org.apache.commons:commons-collections:jar:3.2.1 is missing, no dependency information available
Downloading: http://mvnrepository.com/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://central.maven.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo1.maven.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://snapshots.repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repository.codehaus.org/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-collections/3.2.1/commons-collections-3.2.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.986s
[INFO] Finished at: Thu Sep 04 11:28:24 NZST 2014
[INFO] Final Memory: 9M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mobilewebapp: Could not resolve dependencies for project nz.co.nzlotteries:mobilewebapp:war:1.1.0-SNAPSHOT: Could not find artifact org.apache.commons:commons-collections:jar:3.2.1 in mvnrepo (http://mvnrepository.com) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Answer

jmj picture jmj · Sep 4, 2014

You have invalid repository configured, to fix it, change <url> of mvnrepo2 tohttp://repo1.maven.org/maven2/