4

我有一个父 pom 在 pluginManagement 中为一个插件定义了一些配置项,其中有一个特定的配置。我不想在孩子 pom 中。

我尝试在我的子 pom 中覆盖其他配置项,这有效,但“删除”配置项似乎不起作用。“删除”是指我尝试不填写任何内容,例如:

<configuration>
  <itemIdontWant></itemIdontWant>
</configuration>

以上没有用,我仍然得到相同的配置。在编译过程中。我可以填写一些垃圾来使这个项目的效果无效,但我想要正确的方法来“删除”它。有什么帮助吗?

4

1 回答 1

11

您可以简单地尝试以下方法:

<configuration>
  <itemIdontWant combine.self="override"></itemIdontWant>
</configuration>

上面的问题可能是,如果您想将其设置为空,则插件的默认值将成为该值。

此外,您可以使用以下方法更改配置的继承:

<build>
  <plugins>
    <plugin>
      <inherited>false</inherited>
      <groupId>...</groupId>
      <artifactId>..</artifactId>
    </plugin>
  </plugins>
</build>

以上部分的文档可以在这里找到:https ://maven.apache.org/pom.html

于 2015-10-21T06:52:48.433 回答