【发布时间】:2020-03-02 18:24:25
【问题描述】:
【问题讨论】:
【问题讨论】:
<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>
【讨论】: