Hi Brian,

Thanks for the insight.

The problem with doing something like this would be that the configuration for the sublaunched mojo would still be required separately in the POM, and I wouldn't be able to interrogate the mojo after execution for values that it created for itself. This is because the sublaunched mojo is going to look at the current POM for configuration no differently than if it were launched from the POM.

I'm combining the executions of three mojos in one since their configurations are coupled and am looking to consolidate about 110 lines of interdependent POM configuration between them (that in turn run over two phases) down to about 30 lines in one plugin. It's for the debian plugin, which needs to run assembly plugin to get the source tree and wagon to find out the version of the current maintainer revision on the debian repository and deploy it there with the revision incremented.

Brian

On Nov 22, 2006, at 5:39 PM, Brian E. Fox wrote:

You can cause another goal to execute before your mojo. If you're
creative enough, this might do what you want:
@execute goal=resolve-plugins


-----Original Message-----
From: Brian Topping [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 22, 2006 5:29 PM
To: Maven Developers List
Subject: Configuring a Mojo Programmatically

I have two mojos in two different plugins, and I would like to use
them together, one calling the other one to get some work done.
Let's call them "parent" and "child".  The parent mojo needs to
instantiate the child, and if the child has dependencies, should be able
to have those properly instantiated too.

As best I can tell, this is the same subtree of calls that happens with DefaultPluginManager.getConfiguredMojo(), but it's a private method and
I don't even have a MojoExecution for the child mojo to start with!

So I'm thinking there has to be a better way to do this or just write
off the parent->child relationship as impractical. Assembly seems to be the only plugin that even tries this, and it doesn't do it to the level
that I am looking at here.

If anyone has ideas or is laughing because this is "so not going to
work", please do speak up :-)

Happy indigenous turkey liberation day for those of you that celebrate
such days.

Brian


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to