20

Maven repositories contain these two dependencies: org.apache.commons:commons-io:1.3.2 and commons-io:commons-io:1.3.2. What is the difference and which one I should be using in my pom.xml?

In general some of the apache commons packages are located in http://repo1.maven.org/maven2/org/apache/commons/ and most of the commons-* packages are located here http://repo1.maven.org/maven2/.

Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
  • 1
    I'm just fighting this confusion too. To make matter worse, on Maven repo you'll learn that for commons-io the groupId was changed from org.apache.commons to commons-io, but for commons-lang it's the other way around. – virgo47 Oct 14 '15 at 09:51
  • Beware that if you had an old version of org.apache.commons:commons-io (for instance, in your local maven .m2/repository) it won't have a "relocation" tag in there, so if you have both it and io-commons as dependency/transitive dependencies you may end up with two different versions of the jars in your classpath (yikes maven). To fix remove folder ~/.m2/repository/org/apache/commons/commons-io to force redownload – rogerdpack Dec 04 '15 at 00:17

3 Answers3

13

The deployment of

org.apache.commons:commons-io:1.3.2

Was a mistake that was ultimately fixed by relocating:

POM of org.apache.commons:commons-io:1.3.2

To use commons-io:commons-io:1.3.2.

The mistake was likely an attempt to migrate the Commons IO library to use the current naming convention for Maven groupIds.

catch23
  • 17,519
  • 42
  • 144
  • 217
heenenee
  • 19,914
  • 1
  • 60
  • 86
7

From commons-io website. the latest release is 2.0.1. 1.3.2 is pretty old. Given this information, the repository in http://repo2.maven.org/maven2/commons-io/ holds the latest releases and is the right one to use.

This related mail thread makes interesting reading.

Raghuram
  • 51,854
  • 11
  • 110
  • 122
1

The two dependencies look the same. I would prefer to use commons-io:commons-io, cause the pom of org.apache.commons:commons-io:1.3.2 is wrong (wrong groupId!)

The artifacts located at this position: http://repo1.maven.org/maven2/org/apache/commons/ are newer in date than the others.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235