Hi, I've done several fixes the cobertura plugin and every time I discover that thing which might look simple are often a bit more complicated. This issue is related to MCOBERTURA-86 [1] I think I have defined a clean way to solve this problem, but I haven't got the time to code it. Once this is solved I could have a look at this. -Robert [1] http://jira.codehaus.org/browse/MCOBERTURA-86
> Date: Thu, 10 Mar 2011 19:32:41 +0100 > From: [email protected] > To: [email protected] > Subject: [mojo-user] Cobertura and Emma maven plugins switching build output > directory > > Hello Codehaus mojo users, > > Both Cobertura and Emma maven plugins have instrument goals which > process classes and instrument them for getting coverage data. > Instrument goal in both of them performs additional task of changing > build output directory to the directory where instrumented classes > have been outputted so that other plugins would use that build output > directory instead of standard one with clean non-instrumented classes. > Maybe that behavior is a convention (forcing one to create a separate > module just to get coverage), but convention is great as long as there > is configuration option. For both of these plugins I could not find > documented configuration parameters to configure instrumentation goal > not to do the change of build output directory. Did I miss something? > > I'd like to use same module for tests and for coverage - separate > surefire plugin execution can be configured for the two tasks. > Similarly failsafe plugin can be configured to run integration tests > twice when integration test coverage is needed (once for clean and > second time for instrumented classes). When integration test coverage > is needed I'm fine if both clean and coverage executions are run > together (AFAIAC they can run in parallel), including > pre-integration-test, post-integration-test, and verify bound > executions. > > E.g. for web app when coverage is needed: > - in process-classes phase instrument goal can generate classes (but > leave build output directory as-is) > - in test phase two executions of surefire plugin could run unit > tests, one with non-instrumented classes, and other for coverage with > instrumented one > - in package phase clean and war with instrumented classes can be assembled > - in pre-integration-test phase a app server(s) can be started and > both wars deployed as different contexts > - in integration-test phase two executions of failsafe plugin can run > integration tests on both clean and instrumented web app > - in post-integration-test phase app server(s) can be stopped > - in verify phase failsafe plugin can verify integration-tests > success, while in same phase check goals can be used to verify > coverage requirements > > This would be nice and easy, only if one could turn of that change of > build output directory - only coverage plugin executions (like > surefire execution for coverage tests, assembly execution to create > war for coverage integration tests, and pre integration test phase > deployment of coverage war) are interested in instrumented classes, > all other plugin executions should be agnostic and use default build > output and instrument goal execution should not affect them. Now, one > has to configure all other plugin executions which are not concerned > with coverage to use standard build output directory. > > That is why I've create a ticket ( > http://jira.codehaus.org/browse/MCOBERTURA-138 ) and submitted a patch > with tests which adds support for configuring cobertura maven plugin, > where it should output instrumented classes (this was hardcoded) and > flag to control whether build output directory should be bound to > directory with instrumented classes. Comments and votes are more than > welcome. > > Regards, > Stevo. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > >
