views:

1040

answers:

2
A: 

If you are using eclipse, then you should download the maven plugin from sonatype here http://m2eclipse.sonatype.org/.

This comes with a useful graphic visualisation of your dependencies (in particular transitive dependencies - dependencies you have not explicitly defined in your POM), and also shows conflicting dependencies.

Update: from the comments below, your mileage may vary.

toolkit
I've been using m2eclipse for a while, and find it can be pretty flaky, especially around WTP and nested modules.However, I thought I'd install the POM editor so I could see these transitive dependencies. The first thing that happened in m2eclipse when I tried to view them? "java.lang.NoSuchMethodError". I love irony.
Marty Pitt
I find the m2eclipse "list view" to be much more readable than the graphical view. And it has much better interactions. e.g. Clicking on commons-logging will narrow down and show you just the places that use it.
Dominic Mitchell
Try running the dependency:tree goal in Eclipse. I think it may help if you're having issues with the graphical plugin.
Mike Cornell
+2  A: 

One thing that I've found challenging is determining what is in each package, especially from Spring.

To that end, I've found Netbeans' support for maven to be outstanding in how it lets you know what libraries are pulled in by each requirement. 6.7 Beta contains a graphical tree which is outstanding, and m2eclipse also has a very nice graphical dependency tree. How else would you know that spring-orm includes, spring-beans, spring-core, spring-context, and spring-tx? You can ask maven for the dependencies using the dependency plugin from the command line, but the graphical representation is quite handy. dependency:tree is the goal you want to run. Obviously you can also run that from Netbeans or Eclipse.

So, as an example of one of your collisions:

 <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-annotations</artifactId>
   <version>3.4.0.GA</version>
 </dependency>

actually includes hibernate-commons-annotations-3.1.0.GA not 3.3. It also includes hibernate-core-3.3.0.SP1, not 3.3.1.GA.

I would start at your "biggest" component, and start to see what parts that already includes and only add what is missing. Even then, double check that you don't have a duplicate dependency and if need be, exclude the duplicate as shown in the answer to this question.

Mike Cornell
FYI - the m2eclipse plugin for Eclipse also has the ability to graph dependencies
matt b
Also I think you can use mvn help:effective-pom to get a breakdown of ALL dependencies
matt b
I agree with you that determining the necessary modules to use with Spring is difficult. It would be great if there was a "map" specifying which packages were part of which modules. Does anyone know of such a reference?
Paul Morie
http://mvnrepository.com will, but it just basically lists the entries in the POM of the artifact you're trying to use. For example: http://mvnrepository.com/artifact/org.springframework/spring-orm/2.5.6 lists what spring-orm uses.
Mike Cornell