I don't have a reference handy, but I can explain it. I'll use xpath
syntax to talk about where things are.
If you put a <plugin/> into /project/build/plugins, then you are
asking for an execution whenever you run maven.
If you put it into /project/build/pluginManagement/plugins, then you
are merely specifying version and the default configuration
parameters.
So, if you are using a parent POM structure, you would create
pluginManagement to specify that if any of the inheriting projects use
the plugin in question, here is the configuration they should use --
but you are not telling them all to actually run the plugin.
Similar considerations apply when you have many profiles, some of
which want to execute some plugin, some don't, but all should agree on
the configuration.
A fairly simple example:
... <pluginManagement><plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins></pluginManagement>
All this does is select the version of the release plugin in any
profile or inheritor of the current pom.
If this also included <configuration>, then those parameters would
also apply to those places.
Then, later, in a profile or a pom that uses the above in its parent,
<build><plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
</plugin>
</plugins></build>
would use the version (and configuration) specified.
On Mon, Jul 18, 2011 at 8:34 PM, kanesee <[email protected]> wrote:
> Can someone explain to me or point me to a page that explains what the
> <pluginManagement> is and when it needs to be included?
>
> In some examples I see:
> <build>
> <pluginManagement>
> <plugins>
> ...
>
> In other examples I see:
> <build>
> <plugins>
> ...
>
>
> What's the difference? And how do you know when you use it?
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/When-to-use-pluginManagement-tp4610500p4610500.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]