使用 Maven 执行器跳过模块 [英] Skip module with Maven enforcer

查看:104
本文介绍了使用 Maven 执行器跳过模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在根 pom 的多节点项目中使用 enforcer 插件,但我有一个测试模块,我真的不关心在那里运行插件,因为它不会创建任何 jar并且仅用于测试道具.有没有办法跳过插件配置中的模块之一?

I´m using enforcer plugin in a multi-node project in the root pom, but I have one testing module, that I dont really care to run the plugin there since it wont create any jar and is only for testing propuse. Is there any way to skip one of the modules in the plugin config?.

检查文档我找不到任何东西.只有如何禁止某些特定的依赖项.https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html

Checking the documentation I cannot find anything. Only how to ban some specific dependencies. https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html

将插件放在每个子模块中的解决方案是可能的,但很危险,因为如果我创建一个新的子模块,我可能会忘记在那里添加它

The solution to put the plugin in each sub-module is possible but it's dangerous, since if I create a new sub-module I might forget to add it there

这里是我的插件配置.

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M3</version>
          <executions>
            <execution>
              <id>enforce-maven-version-and-dependencies</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.3.9</version>
                  </requireMavenVersion>
                  <bannedDependencies>
                    <searchTransitive>true</searchTransitive>
                  </bannedDependencies>
                  <dependencyConvergence></dependencyConvergence>
                </rules>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <fail>true</fail>
          </configuration>
        </plugin>

推荐答案

在模块的POM中,将enforcer.skip设置为true:

In the POM of the module, set enforcer.skip to true:

<properties>
  <enforcer.skip>true</enforcer.skip>
</properties>

这篇关于使用 Maven 执行器跳过模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆