• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tracking transitive dependencies in Maven2

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to set up a pom.xml for a WAR that is currently building with ant. The way I have the pom set up right now there are some jars ending up in my WEB-INF/lib folder that my project does not actually need. I have a rather large number of dependencies and it would be a very time consuming task to manually inspect every dependency's pom.xml recursively to track down the path that leads to this dependency.

Is there a tool of some sort that can help me discover how I ended up with xyz.jar as an eventual dependency?

Thanks,
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look into JBoss Tattletale - it provides this type of dependency reporting.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html

It'd be weird for non-dependencies to be put into the WAR, though; are you sure they're not required? Or perhaps they're required for a different phase (like test)?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that tree's output includes the phase:
Here there are only a few "test" libs, but you get the idea.
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the tool advice. These are both very cool.

David Newton wrote:http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html

It'd be weird for non-dependencies to be put into the WAR, though; are you sure they're not required? Or perhaps they're required for a different phase (like test)?



Yeah, so the thing is I'm building a JSF application and I'm ending up with ant-1.7.0 and ant-launcher-1.7.0 in my WEB-INF/lib. According to dependency:tree (ant entries at the bottom, axis2 at the top) these dependencies are showing up by way of Axis2. Axis2 is a dependency because I have some Axis2 web service clients (built by wsdl2java) as dependencies.



I'm certainly not going to be calling ant from my application, and I've been running this app for quite a while without these jars on my classpath. When you create an Axis2 client with wsdl2java a build.xml script is generated as well. This build.xml uses all of the content of your Axis2/lib folder as the build classpath. Instead of manually adding all of these (many) jars as dependencies to the pom.xml I created for this Axis2 client when migrating to Maven2 I just added Axis2 and this, I guess, is the result. I'm thinking I'll just specify excluding files as needed, because I think that it will be less work and less verbose then specifying all the files I do need.

Does this seem like improper use of Maven's dependency management?
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this situation the Axis2 dependency I have declared actually has a packaging of "pom". Maybe I cannot expect my build to be free of unnecessary components knowing that, however without wsdl2java enumerating the compile and run-time required jars for clients built by that tool it is difficult to cut it off at less than all of Axis2, and if that documentation exists I am unable to locate it.
 
Saloon Keeper
Posts: 27852
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may not be calling Ant from your application, but that doesn't mean that the WSDL compiler might not be doing so.

There are ways in a POM to indicate optional adjuncts, but when the component is listed with a "compile" scope, either it's actually in danger of being invoked at some point (Murphy says, when it's most inconvenient), or someone's been sloppy with the dependency setup.

I'll admit that I have had Axis bite me on version conflicts, but that was 5 years ago.
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim,

I should have been a little more specific. As the WAR was previously being built, the entire contents of the /lib folder of the Axis2 install was put on the classpath in one way or another because of the way the build.xml's classpath works as mentioned previously, (and because that is the only information I could find on these generated client's dependencies). Ant is not in this folder so I would presume that Ant is not being used by the web service client. I think the primary locus of sloppiness here the just a lack of easy to find documentation on the dependencies of wsdl2java clients. Though there are also other things going on in Axis2's dependency tree, such as references to the same version of java specifications by different modules where one points to the sun jar and another points to the apache geronimo spec jar, which lead me to believe that the Axis2 Maven layout was not very well implemented on its own.
 
Tim Holloway
Saloon Keeper
Posts: 27852
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think maybe some of this is the usual muddle that happens when a number of people experiment in a number of different ways and you end up with what is basically a set of overlapping, incompatible/dead projects all in one area.

I just took a quick look at the Maven Apache Axis2 repo. I think I'd try including just the axis2-webapp module in the POM, let it suck in any downstream dependencies and add other stuff if/as needed.

Also, looking at the POM for axis2-webapp, I see that apparently it explicitly excludes Ant, which sounds promising.
 
Emilio Kazwell
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim,
I'll look at that module.
reply
    Bookmark Topic Watch Topic
  • New Topic