views:

23

answers:

1

When I generate a Cobertura report by running "mvn cobertura:cobertura" (or "mvn site") then a report is generated which shows the test coverage for my classes but when I click on a class then the message "Unable to locate de/ailis/foo/Bar.java. Have you specified the source directory?" is displayed. How can I fix this? I configured the plugin in the pom.xml like this:

<reporting>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
      <version>2.4</version>
    </plugin>
  </plugins>
</reporting>

So how can I specify the source directory for this plugin (And why is that needed, maven always knows where the source are and obviously they are already used because otherwise I should get an empty report).

+1  A: 

I don't think that the Cobertura report is pointing directly on the real sources (that wouldn't get deployed with a site) but that you are supposed to generate the Source Xref report (an HTML version of the Java sources).

<reporting>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jxr-maven-plugin</artifactId>
    </plugin> 
    ...
  <plugins>
</reporting>

Could you give this a try?

Pascal Thivent