Cobertura’s documentation gives the following example to show how instrumentation can be done on classes inside a jar file that is on Cobertura’s classpath.
<cobertura-instrument todir="${instrumented.dir}">
...........
<fileset dir="../lib">
<include name="myjar.jar" />
</fileset>
...........
</cobertura-instrument>
This approach will instrument all the classes inside the specified jar.
How can I instrument only specified class files inside the jar?
The
cobertura-instrumenttask has two sub-tasks which may do the trick (didn’t have the possibility to try it out):