On Mon, 2005-06-13 at 08:48 +0200, Nicola Ken Barozzi wrote: > Let's say that I have a dependency on project A and project B, and that > both have a dependency on project LOG. > > So I declare a dependency on those in my POM, and the transitive > dependency mechanism will get me also LOG... but which version? > > If I want to specify the version I want, I can add LOG as a /direct/ > dependency. > > Then some time passes, and A and B loose the dependency on LOG. I still > have it in my direct dependencies, and I will still be downloading it > and adding it to the classpath, even if it is not needed. Imagine this > for a tree of transitive dependencies...
At some point in the near future, say 18 months from now, we'll have enough POMs with decent data that we'll be able to find these unused references just like you "optimize imports" in IDEA or Eclipse. > IMHO there should be a distinction between direct and transitive > dependencies in the POM. I should be able to *suggest* the version of > the transitive dependencies to use, but not have it included in the > cleaapath if no direct dependency references it. You can do exactly with the <dependencyManagement/> element in the POM. The <dependencyManagement/> element is your control policy on what version of dependencies are used. They are not added to your dependencies and only kick on when you specify a dependency that in listed in the <depMan/> element. So you can specify in a top-level POM what you want to use version 1.5 of foo. In module POMs you just need to specify the groupId/artifact id and the version will be taken from the listing in the <depMan/> element in the parent POM. -- jvz. Jason van Zyl jason at maven.org http://maven.apache.org We know what we are, but know not what we may be. -- Shakespeare --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
