【问题标题】:How to use maven plugin in profile in settings.xml如何在settings.xml的配置文件中使用maven插件
【发布时间】:2019-03-26 10:27:00
【问题描述】:

我尝试创建一个默认配置文件,该配置文件存储在settings.xml 中,可以由mvn clean install -Pmy-profile 调用。本地放不了pom.xml

我的个人资料如下所示:

<profile>
  <id>check-release</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M2</version>
        <executions>
          <execution>
            <id>enforce-no-snapshots</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireReleaseVersion>
                  <message>No Snapshots Allowed!</message>
                </requireReleaseVersion>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>   

但我得到了:

[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'build'

插件似乎没有做我想做的事。我做错了什么?

【问题讨论】:

  • 您应该提供整个 pom.xml。个人资料必须在个人资料标签内。
  • 对此的简单回答是:无法以任何方式在设置中定义插件...
  • 为什么你不能把配置文件放在例如你的父母 pom?

标签: java maven settings


【解决方案1】:

根据 khmarbaise 的评论,请参阅 Settings Reference – Profiles

settings.xml 中的profile 元素是pom.xml profile 元素的截断版本。它由activationrepositoriespluginRepositoriesproperties 元素组成。 profile 元素仅包括这四个元素 [...]

【讨论】:

  • 所以不能在settings.xml中配置插件?
  • @mealesbia 显然,是的。
猜你喜欢
  • 2012-03-19
  • 1970-01-01
  • 2013-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-07
  • 1970-01-01
相关资源
最近更新 更多