有没有办法在模块之间共享maven插件的公共配置[使用配置文件/etc]?

有没有办法在模块之间共享maven插件的公共配置[使用配置文件/etc]?,maven,Maven,我有一个多模块maven项目,输出2个不同版本的RPM。除了一些文件外,它们非常相似,de.dentrassi.maven RPM插件的配置看起来完全相同 我想看看是否有任何方法可以将配置放在一个.conf文件或其他文件中并使用它,这样我就不必在每次需要更改时编辑两个模块中的配置 我目前正在尝试导入配置,但没有看到任何可行的选项/您的多模块项目可能有一个共同的父pom 您可以在那里定义插件(所有配置)-如果插件不“损害”其他模块,这是有意义的 或者,在父pom的部分定义插件的配置。然后您只需要在

我有一个多模块maven项目,输出2个不同版本的RPM。除了一些文件外,它们非常相似,de.dentrassi.maven RPM插件的配置看起来完全相同

我想看看是否有任何方法可以将配置放在一个.conf文件或其他文件中并使用它,这样我就不必在每次需要更改时编辑两个模块中的配置


我目前正在尝试导入配置,但没有看到任何可行的选项/

您的多模块项目可能有一个共同的父pom

您可以在那里定义插件(所有配置)-如果插件不“损害”其他模块,这是有意义的


或者,在父pom的
部分定义插件的配置。然后您只需要在相关模块中定义(而不是配置)插件。

您的多模块项目可能有一个公共的父pom

您可以在那里定义插件(所有配置)-如果插件不“损害”其他模块,这是有意义的


或者,在父pom的
部分定义插件的配置。然后,您只需要在相关模块中定义(而不是配置)插件。

最简单的事情是定义配置块中所有执行都通用的配置,如下所示:

<project..>
  <modelVersion>4.0.0</modelVersion>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>..</groupId>
          <artifactId>..</artifactId>
          <version>1.0</version>
          <configuration>
            .. Global Configuration which is common for everything
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
<project..>
  <modelVersion>4.0.0</modelVersion>

  <build>
    <plugins>
      <plugin>
        <groupId>..</groupId>
        <artifactId>..</artifactId>
        <executions>
          <execution>
            <id>special-exec1</id>
            <goals>..</goals
            <phase>..</phase>
            <configuration>
             ... supplemental configuration which is not part of the parent
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

所有详细信息都可以在搜索
combine.children
中读取。如果您还需要查看前面提到的文档,也可以防止从父级继承配置。

最简单的方法是定义配置块中所有执行都通用的配置,如下所示:

<project..>
  <modelVersion>4.0.0</modelVersion>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>..</groupId>
          <artifactId>..</artifactId>
          <version>1.0</version>
          <configuration>
            .. Global Configuration which is common for everything
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
<project..>
  <modelVersion>4.0.0</modelVersion>

  <build>
    <plugins>
      <plugin>
        <groupId>..</groupId>
        <artifactId>..</artifactId>
        <executions>
          <execution>
            <id>special-exec1</id>
            <goals>..</goals
            <phase>..</phase>
            <configuration>
             ... supplemental configuration which is not part of the parent
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
所有详细信息都可以在搜索
combine.children
中读取。如果还需要查看前面提到的文档,还可以防止从父级继承配置