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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to