我有多个配置文件的maven项目。在一个配置文件中,我有插件配置(执行测试覆盖的jacoco-maven-plugin):
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<configuration>
<rules>
<rule>
<limits>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.50</minimum>
</limit>
<!-- many other limits here -->
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>但在Windows上,我想跳过一些测试并更改覆盖范围限制,我尝试这样做:
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.children="append">
<excludes>
<exlude>com.example.SomeTest</exclude>
</exclude>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<configuration>
<rules>
<rule>
<limits>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.49</minimum>
</limit>
</limits>
</rule>
</rules>
<excludes>
<exlude>com.example.SomeTest</exclude>
</exclude>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>这个测试com.exaple.SomeTest现在不能在windows上执行,也不包括在覆盖报告中,但是jacoco-maven-plugin没有改变:它不会影响插件配置,我也尝试使用<limit combine.children="override">和<limit combine.children="append">而不是<limit>。
如何正确覆盖profile插件配置中的一个限制(COVEREDRATIO)?
发布于 2019-01-31 17:52:22
当前,您在每次执行中都有配置,这意味着如果您检查有效的pom,则每个执行配置文件的这些配置都是持久的。
我相信你需要的是你想要在插件级别覆盖的配置。
https://stackoverflow.com/questions/50946702
复制相似问题