The "samples" directory contains a working deployment of PurrPackage with Ant. Reading the annotated "ant-build.xml" file will show you what you need to do use PurrPackage in your own project.
If you prefer to use Ivy, Maven, or Gradle to manage your project's dependencies automatically, the only dependency you need to add is:
net.sourceforge.purrpackage:purrpackage:0.7.0
Please adjust the version appropriately. This is configured to transitively bring in Cobertura and its dependencies, as well.
PurrPackage and Cobertura both use on some 3rd party libraries to instrument code and make reports, although they do not use these at runtime. If these dependencies conflict with your project's use of those libraries as well, you may need to be a bit more sophisticated in managinq your classpath or dependencies. (Hibernate, in particular, uses ASM.) In this case, include only the purrpackage and cobertura JAR files when running your tests; omit the rest. Using the alternative
net.sourceforge.purrpackage:purrpackage-runtime:0.7.0when running the tests dependency accomplishes the same thing.
PurrPackage does not yet support running unit tests in parallel. We recommend the "forkMode='once'" setting since performance suffers considerably when starting a new JVM for every set of tests.
The purrpackage-gradle-plugin makes integrating purrpackage trivial for most Gradle builds. See the notes in sample build file for details.
JUnit users should be aware that Gradle's JUnit runner does not support the sort of notifications that PurrPackage needs. To work around this, the Plugin above uses ant to run JUnit tests. This might require some reconfiguration of your test target. TestNG does not suffere from this problem.
PurrPackage is easy to use with Maven via a plugin, as long as your tests are TestNG tests. Unfortunately, PurrPackage will not work with JUnit and Maven's Surefire test runner, since both lack a listener facility.
To use PurrPackage with Maven, just follow the example and advice in the sample POM file. The plugin manages configuration of the listener and uses a minimal set of dependencies at runtime.
The Ant tasks mentioned above are actually implemented as "main()"
methods the can be invoked as Java applications. If you use TestNG,
you should have no trouble configuring the same listener as
illustrated in the Ant section above. If you use JUnit without Ant, or
some custom unit test framework, you will need to find some way for
your test runner to invoke the "inPackage(String)" method of the
static singleton
net.sourceforge.purrpackage.recording.CoberturaManager
instance at the start of each test. That should be all that is
required.