You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Stephen Connolly <st...@gmail.com> on 2008/09/01 15:01:01 UTC

Anyone know how to find out if a plugin is defined in pluginManagement?

So I have some code which does

MavenProject project;

project.getPluginManagement().getPlugins();

This gives me a list of all the plugins in the pluginManagement section....
however this is the effective plugin management list.

So then I go and walk up the tree of parents and check to see what they see
in their pluginManagement sections... and I even create the super-pom and
have a look at what it defines.

All well and good,... so now I can exclude from my list the definitions that
come from up the parent tree....

except that now I'm excluding too much!

If my project defines in pluginManagement, for example maven-javadoc-plugin
as version 2.4... i'll exclude that from my list as the super-pom defines
version 2.4 of maven-javadoc-plugin

Any pointers?

-Stephen

Re: Anyone know how to find out if a plugin is defined in pluginManagement?

Posted by Stephen Connolly <st...@gmail.com>.
hmmm that's still playing silly buggers

If the pom includes a plugin defined in the superpom but does not specify a
version for that plugin, original model seems to still be giving it a
version!

debug probe code here we come!

On Mon, Sep 1, 2008 at 2:29 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> Answering my own question:
>
> dance some dances with project.getOriginalModel()
>
>
> On Mon, Sep 1, 2008 at 2:01 PM, Stephen Connolly <
> stephen.alan.connolly@gmail.com> wrote:
>
>> So I have some code which does
>>
>> MavenProject project;
>>
>> project.getPluginManagement().getPlugins();
>>
>> This gives me a list of all the plugins in the pluginManagement
>> section.... however this is the effective plugin management list.
>>
>> So then I go and walk up the tree of parents and check to see what they
>> see in their pluginManagement sections... and I even create the super-pom
>> and have a look at what it defines.
>>
>> All well and good,... so now I can exclude from my list the definitions
>> that come from up the parent tree....
>>
>> except that now I'm excluding too much!
>>
>> If my project defines in pluginManagement, for example
>> maven-javadoc-plugin as version 2.4... i'll exclude that from my list as the
>> super-pom defines version 2.4 of maven-javadoc-plugin
>>
>> Any pointers?
>>
>> -Stephen
>>
>
>

Re: Anyone know how to find out if a plugin is defined in pluginManagement?

Posted by Stephen Connolly <st...@gmail.com>.
Answering my own question:

dance some dances with project.getOriginalModel()

On Mon, Sep 1, 2008 at 2:01 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> So I have some code which does
>
> MavenProject project;
>
> project.getPluginManagement().getPlugins();
>
> This gives me a list of all the plugins in the pluginManagement section....
> however this is the effective plugin management list.
>
> So then I go and walk up the tree of parents and check to see what they see
> in their pluginManagement sections... and I even create the super-pom and
> have a look at what it defines.
>
> All well and good,... so now I can exclude from my list the definitions
> that come from up the parent tree....
>
> except that now I'm excluding too much!
>
> If my project defines in pluginManagement, for example maven-javadoc-plugin
> as version 2.4... i'll exclude that from my list as the super-pom defines
> version 2.4 of maven-javadoc-plugin
>
> Any pointers?
>
> -Stephen
>