【问题标题】:Why don't work Jacoco? I hope I did everything right为什么不工作Jacoco?我希望我做的一切都是正确的
【发布时间】:2020-03-02 18:24:25
【问题描述】:

https://github.com/Teemitze/TelegramBot

为什么没有显示 Jacoco 统计信息?组装过程中出现警告

由于缺少执行数据文件而跳过 JaCoCo 执行。

【问题讨论】:

    标签: travis-ci jacoco


    【解决方案1】:

    your project

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                    <configuration>
                        <argLine>--enable-preview</argLine>
                    </configuration>
                </plugin>
    

    而与此处的许多其他问题类似,例如“Jacoco doesn't produce coverage reports”和引用JaCoCo documentation

    如果您的项目已经定义了用于测试执行的 VM 参数,请确保它们将包含 JaCoCo 定义的属性

    在 maven-surefire-plugin 的情况下执行此操作的方法之一是使用语法进行后期属性评估:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <argLine>@{argLine} -your -extra -arguments</argLine>
      </configuration>
    </plugin>
    

    另一种方法是将“argLine”定义为 Maven 属性,而不是作为 maven-surefire-plugin 配置的一部分:

    <properties>
      <argLine>-your -extra -arguments</argLine>
    </properties>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <!-- no argLine here -->
      </configuration>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 2010-11-02
      • 2021-05-29
      • 2022-11-12
      • 2011-08-21
      • 1970-01-01
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      • 2017-11-23
      相关资源
      最近更新 更多