Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which pom dependency should I use for jar commons-lang.jar

How do I know which version of a pom dependency I should use if its version is not in the jar name. For example the jar commons-lang.jar, what version of the pom dependency should I use ?

Here are its search results on maven central repo - http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22net.sf.staccatocommons%22%20AND%20a%3A%22commons-lang%22

like image 790
blue-sky Avatar asked Dec 16 '22 04:12

blue-sky


2 Answers

First, use the one from Apache.

Second, you have two options, the 2.x or 3.x branches; from searching mvnrepository.com:

2.6

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>

3.1

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.1</version>
</dependency>

If you're using Maven, you shouldn't have "just a jar", you should only know about POM dependencies.

(As of Feb 2014 it's up to 3.3.2, the 2.x series is still at 2.6. Note that you may use both in the same application because of their different packages.)

like image 141
Dave Newton Avatar answered Dec 28 '22 13:12

Dave Newton


While the other answers are correct a very handy way to find out exact match for an unknown jar where all you have is the jar itself and it does not contain a useful manifest is to create a sha1 checksum of the jar and then do a checksum search on http://search.maven.org in the Advanced Search at the bottom or on your own instance of a Nexus repository server that downloaded the index of the Central Repository.

And btw your search on central was incorrect since it had the wrong groupId as part of it. Here is a corrected link:

http://search.maven.org/#search%7Cga%7C1%7C%22commons-lang%22

like image 41
Manfred Moser Avatar answered Dec 28 '22 12:12

Manfred Moser