views:

48

answers:

3

I am trying to convert a Java project which uses Ant into a Maven project, but am having difficulties finding out which dependencies to include.

How do I find out dependency settings for a particular import?

+1  A: 

Provided you currently have the jars on your build-path, at least in Eclipse, when you CTRL + click an imported class, and you have selected "link with editor" on the package explorer, the bytecode outline is opened and the file is selected within the jar it is located.

Then, having the m2eclipse plugin, you right-click your pom -> Maven -> Add dependency, and type the name of the jar there. In most cases that would do.

Bozho
I need to know the settings so that Maven can download the correct jars
Xetius
I updated my answer, but again assuming you use Eclipse. Is this so?
Bozho
Yes, this is so. Thanks
Xetius
+1  A: 

How do I find out dependency settings for a particular import?

The easiest way to do that (in a generic way) is to use something like Jarvana, a "Maven-Focused Java Class and Archive Search Engine".

UPDATE: You'll find more search engines in the Frequently Asked Technical Questions that I'm quoting below. I like Jarvana but I don't have any particular recommendation:

How to find dependencies on public Maven repositories?

You could use the following search engines:

Pascal Thivent
+1  A: 

Another vote for jarvana. There are also (that I know of) mvnrepository.com and www.mvnsearch.org

You need to be careful and figure out the correct version of the jar you need. Also, the repos often have many duplicates; different names for what appears to be the same thing, so you need to figure out which one is the "real" one.

Lumpy Oatmeal
+1 using a maven search engine is the way to go IMHO
Pascal Thivent