Hi All,

Are the <dependecyManagement> and <pluginManagement> behave in same way as
far as inheritance of <dependency>  and <plugin> are concerned
respectively...

Because I found two contrast behavior from these two :

1. In case of <pluginManagement>all plugins specified in Parent POM get
inherited by child POM.
    -> Example:  SUPER POM has a default set of plugins defined in
<pluginManagement> section and I can run those on any POM without any
<plugin> entry defined to that POM. [all plugins get inherited]
2. In case of <dependecymanagement> only those dependencies will get
inherited that have been specified in child POM via {groupId, artifactId}
  -> Example : see this example over maven
documenetation<http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management>

Help me understand the <plugin/dependencyManagement> !!!
Thanks,
Amaresh

Why is that difference in behavior?.
Thanks,
Amaresh

On Fri, Jan 14, 2011 at 4:51 PM, amaresh mourya <[email protected]>wrote:

> Hi All,
>
> What extra things <pluginManagement> provides than using only <plugins>.
>
> CASE 1: if I have  a parent POM having few plugins in <pluginManagement>
> section
> ---> so the children POMs will be using same version of plugin as specified
> in <pluginManagement> and I do not even need to specify anything in my child
> POM, why is that ? Because the maven 
> documentation<http://maven.apache.org/pom.html#Plugin_Management>says you 
> need to add plugin entry in your child POM to use that plugin
> (specified in parent POM's pluginManagement section,). I thought I will add
> that plugin in child pom only if I want to change version.
>
> Line from the page :
> *"If we added these specifications to the plugins element, they would
> apply only to a single POM. However, if we apply them under the
> pluginManagement* element, then this POM *and all inheriting POMs that add
> the maven-jar-plugin to the build will get the pre-process-classesexecution 
> as well. So rather than the above mess included in every child
> pom.xml, only the following is required:* "
>
> CASE2: if I donot use  <pluginManagement> and only use <plugins>:
> ---> In this case also I can get everything I want as above. All child pom
> gets the plugins define in parent pom without adding any entry. OS what's
> the difference?
>
> So whats the point in going for <pluginManagement>, Is it only to Enforce
> to use same version of plugin and provide some clarity to whole application
> (parent and child) or it is for more than these?
>
> Please provide some test case to understand the difference..
> Thanks,
> Amaresh
>
>
>

Reply via email to