maven transitive dependency trivia

0 views
Skip to first unread message

hanasaki

unread,
Nov 18, 2009, 11:31:51 PM11/18/09
to KCJ...@googlegroups.com
1. if a parent pom.xml defines a build section with jdk specific compile
version: can the pom using the parent redefine the jdk version just for
itself? If it is not overridden / redefined, will the same build
section and versions and options automatically be inherited by the child?
2. will all parent pom dependencies automatically go to the child pom
(inheritance)? with the same <scope>? would this also imply that a
child pom automatically implicitly declares its parent as a dependency?

the goal is to define a parent pom.xml that can be used by another
pom.xml in its <parent> section and
a. get the same build other plugin (ex: WAR, JAR) options
b. not need to define dependencies because they are in the parent and
passed to the client.

Chris Sams

unread,
Nov 19, 2009, 1:23:41 AM11/19/09
to kcj...@googlegroups.com
Yes to all, assuming you mean through the plugins or dependencies sections vs. pluginManagement and dependencyManagement, which are different.  I'm not sure what you mean by "implicitly declares its parent as a dependency."   In any case, I suggest experimenting with mvn help:effective-pom in your child projects to get some insight into how maven merges the poms from the child up through the super pom.

The following chapter of the sonatype maven book is relevant to your questions:

http://www.sonatype.com/books/maven-book/reference/pom-relationships-sect-project-inheritance.html

In fact, the entire book is a good maven reference.


--

You received this message because you are subscribed to the Google Groups "KCJava" group.
To post to this group, send email to kcj...@googlegroups.com.
To unsubscribe from this group, send email to kcjava+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/kcjava?hl=.



Reply all
Reply to author
Forward
0 new messages