when i instrument my classes using Maven 2 using the command
mvn cobertura:instrument
The output (the instrumented classes) are put in \target\generated-classes. Is there a way to change the output location to \target\classes?
I checked the instrumentation tasks of the cobertura-maven plugin but this does not give me a solution sofar.
As far as I understand, the instrumented classes are only needed by cobertura for report generation. If you create them in
target/classes, they will overwrite the original class files.If you need the instrumented files in a jar as a result, you can configure the
maven-jar-pluginto pick up the files from thetarget/generated-classesdirectory instead of or in addition to the files from the standard${build.project.outputDirectory}.Edit
Have a look at the maven-jar-plugin description. To only use
target/generated-classes, the following addition to your POM should work – try it and modify it to your needs:${project.build.directory}points to your target folder,${project.build.ouputDirectory}to target/classes. I do not know if you can simply set${project.build.ouputDirectory}to a new value – have a look at the this chapter of the maven book, maybe you find some hintsEdit 2
Alternativly or additionally you can use maven to copy the files from target/generated-classes to target/classes after
coberture:instrumenthas finished. This question has one answer with an example POM (fragment), you just have to identify the correct phase (process-resources is definitely too early for your case)