【问题标题】:Sub-module cobertura jenkins reports子模块 cobertura jenkins 报告
【发布时间】:2012-07-21 16:48:15
【问题描述】:

我们有以下布局的项目

  1. 父级
    • 应用程序
    • 核心
    • 仪器

核心模块中有cobertura插件。我能够从命令行毫无问题地生成报告(XML 和 HTML)我什至能够在 Jenkins 的工作区中看到它们。但是我无法将这些报告与 Jenkins Cobertura 插件相关联。 根据 Jenkins 文档的默认设置是

**/target/site/cobertura/coverage.xml

由于子模块中生成的报告,这不起作用。我试过了

core/target/site/cobertura/coverage.xml
/core/target/site/cobertura/coverage.xml
**/core/target/site/cobertura/coverage.xml

【问题讨论】:

  • 报告相对于 ${WORKSPACE} 的位置在哪里?
  • 转到工作区选项我将通过 core/target/site/cobertura/coverage.xml 访问报告

标签: continuous-integration jenkins cobertura


【解决方案1】:

好的,问题是我使用cobertura插件作为

<build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>cobertura-maven-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <formats>
              <format>xml</format>
              <format>html</format>
            </formats>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

应该是这样的

<build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <formats>
            <format>xml</format>
            <format>html</format>
          </formats>
          <check/>
        </configuration>
        <executions>
          <execution>
            <phase>clean</phase>
            <goals>
              <goal>cobertura</goal>
            </goals>
          </execution>
        </executions>
      </plugin> 
  </build>

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

在此之后,我将 Jenkins Cobertura 插件指向 core/target/site/cobertura/coverage.xml

【讨论】:

    【解决方案2】:

    在您的应用程序目标中添加以下行:(在 jenkins 中配置应用程序部分)

    cobertura:cobertura -Dcobertura.report.format=xml
    

    Cobertura xml 报告模式:
    */target/site/cobertura/.xml

    pom.xml 更改:

    <reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <formats>
                    <format>html</format>
                    <format>xml</format>
                </formats>
            </configuration>
        </plugin>
    </plugins>
    

    【讨论】:

      猜你喜欢
      • 2014-02-26
      • 2011-04-15
      • 2012-09-22
      • 2014-06-30
      • 2017-01-03
      • 2010-11-04
      • 2010-11-14
      • 2013-04-27
      • 2011-03-02
      相关资源
      最近更新 更多