首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >覆盖配置文件中的插件配置

覆盖配置文件中的插件配置
EN

Stack Overflow用户
提问于 2018-06-20 19:03:25
回答 1查看 745关注 0票数 2

我有多个配置文件的maven项目。在一个配置文件中,我有插件配置(执行测试覆盖的jacoco-maven-plugin):

代码语言:javascript
复制
<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上,我想跳过一些测试并更改覆盖范围限制,我尝试这样做:

代码语言:javascript
复制
<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)?

EN

回答 1

Stack Overflow用户

发布于 2019-01-31 17:52:22

当前,您在每次执行中都有配置,这意味着如果您检查有效的pom,则每个执行配置文件的这些配置都是持久的。

我相信你需要的是你想要在插件级别覆盖的配置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50946702

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档