maven-cobertura-plugion does not show the sources [closed]

纵然是瞬间 提交于 2019-12-10 23:39:11

问题


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:


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?



来源:https://stackoverflow.com/questions/3202985/maven-cobertura-plugion-does-not-show-the-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!