maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: How do I get the configuration for a plugin in a MavenProject? Was: Re: svn commit: r1154621 - in /maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site: AbstractDeployMojo.java SiteStageDeployMojo.java
Date Tue, 09 Aug 2011 20:39:05 GMT
Thanks Benjamin,

This was exactly the information I was looking for.

On 2011-08-08 23:22, Benjamin Bentmann wrote:
> Dennis Lundberg wrote:
> 
>>          Map<String,Plugin>  map = project.getBuild().getPluginsAsMap();
>>
>> This is nice, because in Maven 3 I get the complete effective set of
>> plugins, from both build/plugins and build/pluginManagement.
> 
> I hope this means "get the set of build/plugins as seen in
> help:effective-pom, including plugins contributed by lifecycle mappings,
> with their effective configuration, i.e. after merging in inheritance,
> profiles and build/pluginManagement". This map should not include
> plugins from build/pluginManagement unless that plugin is also declared
> in the build/plugins section or in a lifecycle mapping.
> 
>> This doesn't work in Maven 2
> 
> I assume you refer to the fact that plugins from lifecycle mappings do
> not show up among build/plugins.
> 
>> What I have found is that I can get all plugins from build/plugins *or*
>> all plugins from build/pluginManagement, but not both at the same time.
>> I could combine the result of the two, but what happens if a plugin
>> exits in both? How would I merge the configuration of the two?
> 
> Plugin sitePlugin = (get from build/plugins)
> if (sitePlugin == null) {
>    sitePlugin = (get from build/pluginManagement/plugins)
> }
> // continue config extraction from sitePlugin
> 
> If the plugin is declared in both build/plugins and
> build/pluginManagement, both Maven 2.x and 3.x will already have handled
> the configuration merging such that build/plugins contains effective
> configuration.
> 
> 
> Benjamin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 


-- 
Dennis Lundberg

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


Mime
View raw message