You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wouter Zoons <wo...@coditel.net> on 2005/11/22 12:30:46 UTC

Invoking plugin execution from a mojo

hi all,

I was wondering how to tackle a problem I'm experiencing: I'm adding 
support for Emma code coverage to my company's build infrastructure 
which is currently being ported to Maven 2.

I would like to:

1. instrument our code
2. execute the tests on this instrumented code
3. build a report from it

I have written a mojo for each individual step and bundled them into a 
plugin. I've got everything working except step #2

I would like this step to be completely independent from the tests in 
the default build process, meaning our tests would be run twice in total 
(once for testing the code and once for determining the coverage)

We want this separation because we only want to use the instrumented 
code when running emma, not when running the regular tests for example..

Is this a bad idea ? Why is it different in the Clover plugin ?

So my real question is: from within a Mojo, how can I execute the 
surefire plugin ?

I have changed the test classpath element list and placed the 
instrumented code at index 0, so these classes are found first but how 
can I now run surefire using its existing configuration ?

code snippet would be great

thanks in advance

-- Wouter

wouter [at] andromda [dot] org
http://www.andromda.org/






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


Re: Invoking plugin execution from a mojo

Posted by Brett Porter <br...@gmail.com>.
I think you are on the right track here.

What you would do is:

@execute phase="test" lifecycle="emma"

Inside the plugin , you can define a custom lifecycle that will add
your own goals in addition to the normal ones, eg to process the
classes into a new directory. You can modify the project object, it
will be returned to the original when the goal completes. You can get
access to that project in the final mojo/report with the
${executedProject} variable.

Hope that helps - there is some more information on the "introduction
to the build lifecycle" guide.

Cheers,
Brett

On 11/22/05, Wouter Zoons <wo...@coditel.net> wrote:
> hi all,
>
> I was wondering how to tackle a problem I'm experiencing: I'm adding
> support for Emma code coverage to my company's build infrastructure
> which is currently being ported to Maven 2.
>
> I would like to:
>
> 1. instrument our code
> 2. execute the tests on this instrumented code
> 3. build a report from it
>
> I have written a mojo for each individual step and bundled them into a
> plugin. I've got everything working except step #2
>
> I would like this step to be completely independent from the tests in
> the default build process, meaning our tests would be run twice in total
> (once for testing the code and once for determining the coverage)
>
> We want this separation because we only want to use the instrumented
> code when running emma, not when running the regular tests for example..
>
> Is this a bad idea ? Why is it different in the Clover plugin ?
>
> So my real question is: from within a Mojo, how can I execute the
> surefire plugin ?
>
> I have changed the test classpath element list and placed the
> instrumented code at index 0, so these classes are found first but how
> can I now run surefire using its existing configuration ?
>
> code snippet would be great
>
> thanks in advance
>
> -- Wouter
>
> wouter [at] andromda [dot] org
> http://www.andromda.org/
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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