Code Coverage in Confluence Server Plugins



We are working through adding code coverage to one of our Confluence plugins.

Our first attempt has been with OpenClover and it is proving problematic with our Integration Tests (Unit tests are generating code coverage quite happily)

Clover tests need to have access to classes in clover-runtime.jar to work correctly, but we do not want to add this as a compile dependency as it is only required for our integration tests. Our integration tests are using Arquillian.

We attempted to add clover-runtime.jar as a libArtifact, which copies the jar into WEB-INF/lib correctly, but does not seem to actually expose the classes that the plugin needs. The plugin won’t enable with a ClassDefNotFound error looking for com_atlassian_clover

This is complicated by the fact that confluence bundles an old version of clover-runtime.jar (3.4.1), which may be conflicting in some way?

Basically I have two questions:

  • How are other plugin developers measuring code coverage? Should I just take the easy road and get JaCoCo or another library?
  • Has anyone managed to get OpenClover working with a Confluence plugin with remote integration tests? If so, what am I missing?

Thanks in advance.


If anyone can share how to deploy (i.e. via pom.xml or some arcane maven calls) the clover-runtime (for OpenClover) into a container started by atlassian SDK when running integration tests (we are looking to do this in Bamboo), so the plugin code can actually find it via OSGi class loaders - this will be great.


I have also been trying something similar in Jira so if anyone has actually done it and has some tips lets us know tks