Tra*_*irk 7 java maven-2 code-coverage cobertura
我有一些已经通过maven进行网站生成的项目,我想在其中集成cobertura报告,但我似乎没有运行的maven目标将生成本地预览供我查看,其中包括Cobertura报告中的现场.我想确保它们在我将pom更改到repo之前正确生成并且已经生成了破坏的站点.
下面是我添加到maven poms(父级和模块)的内容,但是我运行时看到的网站mvn site:run不包括cobertura报告:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<check>
<haltOnFailure>false</haltOnFailure>
<regexes>
<regex>
<pattern>parent-package-name-here.*</pattern>
<branchRate>80</branchRate>
<lineRate>80</lineRate>
</regex>
</regexes>
</check>
<instrumentation>
<includes>
<include>parent-package-name-here/**/*.class</include>
</includes>
</instrumentation>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>site</phase>
<goals>
<goal>instrument</goal>
<goal>cobertura</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
...
</project>
Run Code Online (Sandbox Code Playgroud)
我应该用什么maven命令来生成带有cobertura报告的网站?或者,我应该添加(另外)以使网站生成包括cobertura报告?
我想出了如何做到这一点。
Maven 站点生成插件中的链接生成似乎存在很多错误。
我发现让 Maven 生成具有工作模块链接的站点本地副本的唯一方法是修改标记distributionManagement/site以指向某个本地目录而不是实际部署目录,然后使用maven site:deploy.
每次尝试使用mvn site:stage都会生成损坏的链接。同样适用于mvn site:run.
报告链接可与mvn site:run/配合使用mvn site:stage,但模块链接则不能。