maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rinku <rahul.thakur.x...@gmail.com>
Subject Re: Reconfiguring a plugin from within another plugin?
Date Wed, 05 Jul 2006 22:42:04 GMT
Hi ,

I am not sure about 'updating' plugin configuration from another one; 
but to obtain a reference to JAR plugin, you could try something like 
below (from the maven-eclipse-plugin sources):


======== <snip> =======
    public static String getPluginSetting( MavenProject project, String 
artifactId, String optionName,
                                           String defaultValue )
    {
        for ( Iterator it = 
project.getModel().getBuild().getPlugins().iterator(); it.hasNext(); )
        {
            Plugin plugin = (Plugin) it.next();

            if ( plugin.getArtifactId().equals( artifactId ) )
            {
                Xpp3Dom o = (Xpp3Dom) plugin.getConfiguration();

                if ( o != null && o.getChild( optionName ) != null )
                {
                    return o.getChild( optionName ).getValue();
                }
            }
        }

        return defaultValue;
    }
======== </snip> ========


Russell, Mark wrote:
> I have a custom plugin that generates a bunch of code, and the final jar
> that includes this code needs to have certain manifest entries based on
> the generated code.
>
> Unfortunately the code it generates is somewhat variable so manually
> setting the entries in the pom would be rather error prone (which is one
> thing I'm expending a great deal of effort to prevent).
>
> At the moment I'm hoping that I could somehow get a reference to the jar
> plugin from within my custom code and modify its configuration or get
> the pom configuration and modify it before the jar plugin is invoked.
> Alternately I'll have to write a custom jar plugin that references a
> singleton class to get some of its configuration (which I'd rather not
> do since that is a really bad way to do things)
>
> MAR
>
> -----Original Message-----
> From: Rinku [mailto:rahul.thakur.xdev@gmail.com] 
> Sent: Wednesday, July 05, 2006 3:55 PM
> To: Maven Developers List
> Subject: Re: Reconfiguring a plugin from within another plugin?
>
>
> What is your use case? - may be there is another way to do it.
>
> Cheers,
> Rahul
>
> Russell, Mark wrote:
>   
>> Is it possible to reconfigure a plugin from within another plugin? (ie
>> could a plugin bound to the initialize phase modify the configuration
>>     
> of
>   
>> a plugin bound to the package phase?)
>>
>>  
>>
>> If so, how would I do it?
>>
>>  
>>
>> MAR
>>
>>
>>   
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>   

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


Mime
View raw message