On 24-Feb-08, at 12:19 PM, Carlos Sanchez wrote:

Is it possible to get a Mojo instance from the embedder ?


If you have the component in the classpath then yes, but Maven plugins are special cases in that in Maven itself dynamically downloads the plugin, makes it visible to the container to lookup. So it's not a standard lookup in the sense that the classpath is complete prior to lookup. So with the container itself, you can't do that because the plugin won't exist on the classpath yet. But with the embedder the methods are in there are already to validate the plugin which means downloading and making it available for lookup. Then if you want it to be configured with the correct layering of configuration then that's also Maven specific code.

So short answer is no. This is above and beyond what the container does even though I would like the container to do this the code found it's way into Maven specifically.

If you are just trying to execute a mojo then the same code we use to do that in the plugin manager could be exposed.

I started with
getPlexusContainer ().lookup(org.apache.maven.plugin.Mojo.ROLE,"resources:resources")
and of course didnt work, I guess you'd need the embedder to process
the lifecycle first so the Mojos are available. Any hints?

--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                            -- The Princess Bride

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


Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
jason at sonatype dot com
----------------------------------------------------------

Script timed out




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

Reply via email to