pom 包装模块上的 cobertura

发布于 2024-12-25 09:31:02 字数 1133 浏览 2 评论 0原文

我有一个多模块 Maven 项目。我想为网站生成一份汇总的 cobertura 报告。我运行mvn site的模块是pom打包,所以maven在生成站点时给我这个

[INFO] >>> cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent >>>
[INFO] 
[INFO] --- cobertura-maven-plugin:2.5.1:instrument (report:cobertura) @ parent ---
[INFO] Skipping cobertura mojo for project with packaging type 'pom'
[INFO] 
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent <<<
[INFO] Not executing cobertura:report as the cobertura data file (/home/user/parent/target/cobertura/cobertura.ser) could not be found

相关的pom部分:

...
<reportPlugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
      <aggregate>true</aggregate>
    </configuration>
  </plugin>
</reportPlugins>
...

Cobertura只生成一个空的target/site/cobertura/index.html 文件。有没有办法“强迫”cobertura运行?或者通过其他方式获取我的汇总报告?

I have a multi-module maven project. I want to generate a aggregated cobertura report for the website. The Module im running mvn site on is pom-packaging, so maven give me this when generate the site

[INFO] >>> cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent >>>
[INFO] 
[INFO] --- cobertura-maven-plugin:2.5.1:instrument (report:cobertura) @ parent ---
[INFO] Skipping cobertura mojo for project with packaging type 'pom'
[INFO] 
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent <<<
[INFO] Not executing cobertura:report as the cobertura data file (/home/user/parent/target/cobertura/cobertura.ser) could not be found

The related pom part:

...
<reportPlugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
      <aggregate>true</aggregate>
    </configuration>
  </plugin>
</reportPlugins>
...

Cobertura only generates a empty target/site/cobertura/index.html file. Is there a way to "force" cobertura to run? Or another way to get my aggregated report?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不必在意 2025-01-01 09:31:02

在您的配置部分中使用:

 <forceMojoExecution>true</forceMojoExecution>

In your configuration section use:

 <forceMojoExecution>true</forceMojoExecution>
西瓜 2025-01-01 09:31:02

在报告生成中,我们应该启用输出格式 html,如下所示。

<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>
    </reporting>

In report generation, we should have output format html enabled, like below.,

<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>
    </reporting>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文