0

次のレイアウトのプロジェクトがあります

    • アプリ
    • 計装

コアモジュールには 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
4

2 に答える 2

1

OK、問題は、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に向けます。

于 2012-08-13T12:07:20.297 に答える
0

以下の行をアプリケーションの目標に追加します:(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-06-05T09:08:51.993 に答える