Search code examples
javamavenapache-commons

In maven it's "org.apache.commons.collections:commons-collections" the same as "commons-collections:commons-collections"?


I just saw on my pom files that there are two different group id's for Apache commons-collections:

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

And this one:

<dependency>
    <groupId>org.apache.commons.collections</groupId>
    <artifactId>commons-collections</artifactId>
</dependency>

Are these two the same? and if they are the same, which one should is use by convention?


Solution

  • For commons-collections version 3, there is no groupId: org.apache.commons.collections, so prior to version 4 use:

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

    Since version 4:

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
      <version>4.1</version>
    </dependency>
    

    Note that the artifact id has changed to commons-collections4.

    Reference: https://issues.apache.org/jira/browse/COLLECTIONS-382