You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by amaresh mourya <am...@gmail.com> on 2011/01/14 12:21:04 UTC

use of plugin and pluginmanagement

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-classes execution 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

Re: use of plugin and pluginmanagement

Posted by amaresh mourya <am...@gmail.com>.
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 <am...@gmail.com>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
>
>
>

Re: use of plugin and pluginmanagement

Posted by amaresh mourya <am...@gmail.com>.
thanks,

Re: use of plugin and pluginmanagement

Posted by hablutzel1 <ha...@GMAIL.COM>.
So there is an error in the official maven documentation at
http://maven.apache.org/pom.html#Plugin_Management, quoting 

> *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-classes
> execution as well. So rather than the 
> above mess included in every child pom.xml, only the following is
> required:

It is talking about a plugin configuration, but it is not right to state
that adding "plugin" specifications to the "plugins" elements would apply
only *to a single POM*, as adding it to the parent would apply to the parent
and all the childs inheriting from it.

This is confirmed by Wayne Fay post where he indicates the difference of
'pluginManagement' over 'plugins':

> The plugins declared in the build section of your parent will be 
> inherited (and executed) in all of those children poms. In many cases, 
> you might only want a given plugin to actually be used in a few of 
> those children, or even just one, and frequently not in the parent. 

I think that the documentation should say something like this in that
paragraph:

"If we added these specifications to the parent's build/plugins element,
they would apply to the parent and all the inheriting childs which isn't
usually the expected behaviour. However, if we apply them under the parent's
pluginManagement element, then parent's POM and/or inheriting POMs that
added the maven-jar-plugin to the build as shown below will get the
pre-process-classes execution."



--
View this message in context: http://maven.40175.n5.nabble.com/use-of-plugin-and-pluginmanagement-tp3341163p5793777.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: use of plugin and pluginmanagement

Posted by Dean Schulze <de...@yahoo.com>.

Hi Wayne,

Here are my suggestions so far:

Descriptions of what the various elements in a pom do (similar to the Ant documentation).

Sequence diagrams for maven execution (typical cases) to show how POM elements affect the build.

How do phases and goals relate to POM elements?

Changes from Maven 2 to Maven 3.

Thanks.




--- On Sun, 1/16/11, Wayne Fay <wa...@gmail.com> wrote:

From: Wayne Fay <wa...@gmail.com>
Subject: Re: use of plugin and pluginmanagement
To: "Maven Users List" <us...@maven.apache.org>
Date: Sunday, January 16, 2011, 8:27 PM

> Maven documentation authors - please study Wayne's concise statement below.  That is
> what we need in the Maven documentation.  Not the long-winded, stream-of-consciousness
> that the existing maven docs currently are.

Thanks Dean. I was just recently invited to join Maven dev team and I
do plan to make some improvements to the documentation. ;-) It won't
happen overnight, but hopefully we can make things easier for
everyone. Along those lines... any suggestions you may have would be
greatly appreciated!!

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




      

Re: use of plugin and pluginmanagement

Posted by Wayne Fay <wa...@gmail.com>.
> Maven documentation authors - please study Wayne's concise statement below.  That is
> what we need in the Maven documentation.  Not the long-winded, stream-of-consciousness
> that the existing maven docs currently are.

Thanks Dean. I was just recently invited to join Maven dev team and I
do plan to make some improvements to the documentation. ;-) It won't
happen overnight, but hopefully we can make things easier for
everyone. Along those lines... any suggestions you may have would be
greatly appreciated!!

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: use of plugin and pluginmanagement

Posted by Dean Schulze <de...@yahoo.com>.
Wayne,

Thanks for your concise statement. I'm new to maven and have been trying to figure out how to use maven by reading the documentation.  What a quagmire.

Maven documentation authors - please study Wayne's concise statement below.  That is what we need in the Maven documentation.  Not the long-winded, stream-of-consciousness that the existing maven docs currently are.


--- On Fri, 1/14/11, Wayne Fay <wa...@gmail.com> wrote:

From: Wayne Fay <wa...@gmail.com>
Subject: Re: use of plugin and pluginmanagement
To: "Maven Users List" <us...@maven.apache.org>
Date: Friday, January 14, 2011, 9:05 AM

> What extra things <pluginManagement> provides than using only <plugins>.

PluginManagement does ONE THING ONLY (essentially).
It provides a central location for all of your plugin versioning and
configuration.
THAT'S IT.

You still need to declare the <plugin> in the <build> section of your
various poms (children or parents) where you actually want to USE any
of those plugins in your build.

> 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.

Then you thought wrong.

> 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?

The plugins declared in the build section of your parent will be
inherited (and executed) in all of those children poms. In many cases,
you might only want a given plugin to actually be used in a few of
those children, or even just one, and frequently not in the parent.

> 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?

That is essentially the only purpose for pluginManagement.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




      

Re: use of plugin and pluginmanagement

Posted by Wayne Fay <wa...@gmail.com>.
> What extra things <pluginManagement> provides than using only <plugins>.

PluginManagement does ONE THING ONLY (essentially).
It provides a central location for all of your plugin versioning and
configuration.
THAT'S IT.

You still need to declare the <plugin> in the <build> section of your
various poms (children or parents) where you actually want to USE any
of those plugins in your build.

> 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.

Then you thought wrong.

> 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?

The plugins declared in the build section of your parent will be
inherited (and executed) in all of those children poms. In many cases,
you might only want a given plugin to actually be used in a few of
those children, or even just one, and frequently not in the parent.

> 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?

That is essentially the only purpose for pluginManagement.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org