Hi,

I've been looking at doing something similar. I want to call another
MOJO  from within my MOJO.

There is entry in the mailing archives. See
(http://mail-archives.apache.org/mod_mbox/maven-dev/200511.mbox/[EMAIL 
PROTECTED])

A suggestion is made to run a plugin by invoking maven again through a
command line interface. (This is how it is done in the
maven-release-plugin)

So then you could:
1) Invoke your MOJO
2) Use the command line to run compile
3) Do your stuff
3) User the command line to run compile again

Cheers,
Ian

On 18/12/06, Kenney Westerhof <[EMAIL PROTECTED]> wrote:


Magne Rasmussen wrote:
> Hi.
>
> I have an plugin which processes the class files generated by compile,
> generates a new java file based on the class files, and then needs to
> compile this generated java file.
>
> The question is: Can I get hold of, and run, the compile mojo from
> within my plugin? If so, how do I do that?
>

No, you can't.
You should split this up into 2 projects - one that produces the first class 
files,
and a second project that generates code from the class files of the first 
project.

There might be a workaround though, but it's not recommended: process the 
classes
in the process-classes phase, generating the source files.

Then configure the compiler plugin to also run in the process-classes phase to 
compile
the newly generated sources. It might not run in the correct order, though.
I really recommend splitting up into 2 projects.

-- kenney


> Magne Rasmussen
>

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