0

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?

j2gl
  • 706
  • 3
  • 20
  • 28
  • 1
    The second one doesn't exist in public Maven repo: http://search.maven.org/#search|ga|1|g%3A%22org.apache.commons.collections%22 So impossible to say. – Tunaki Mar 08 '16 at 16:57
  • The groupId is not `org.apache.commons.collections` but `commons-collections` in your link. I don't understand. – Tunaki Mar 08 '16 at 17:20
  • 1
    I didn't test it but I'm pretty sure it doesn't work since the artifact doesn't exist in public Maven repo. – Tunaki Mar 08 '16 at 18:10
  • 1
    @j2gl The correct groupId depends upon which version of the artifact you want to use. Modern releases use the `org.apache...` variant. – Duncan Jones Mar 08 '16 at 20:46
  • Thanks @Tanuki for your help, there was a custom artifact installed on our custom maven repo (nexus) with a custom hibernate and commons-collections on legacy. – j2gl Mar 08 '16 at 20:58
  • Yes @Duncan, as you said they change it on to org.apache... on commons-collections version 4. – j2gl Mar 08 '16 at 20:58

1 Answers1

6

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

j2gl
  • 706
  • 3
  • 20
  • 28
  • 1
    They changed the groupId of Commons Collections to `org.apache.commons` so the project would finally adhere to the [best practice of basing the groupId on the domain name](http://stackoverflow.com/questions/32184114/apache-commons-inconsistent-naming-convention). – heenenee May 24 '16 at 19:08