Maven:覆盖父pom,将映射添加到“ rpm-maven-plugin”

时间:2018-07-09 09:07:59

标签: java maven rpm

我有一个带有父pom和许多子模块的maven项目。 大多数模块与父pom共享相同的rpm打包配置,但是在某些情况下,我需要重写配置以添加映射(我基本上需要向rpm添加一个额外的文件)。

我尝试在父pom中执行此操作:

    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>rpm-maven-plugin</artifactId>
      <version>2.1.5</version>
      <executions>
        <execution>
          <id>generate-rpm</id>
          <goals>
            <goal>rpm</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        ...
        <mappings>
          <mapping>
            ...
          </mapping>
          <mapping>
            ...
          </mapping>
          </mapping>
        </mappings>
      </configuration>
    </plugin>

在孩子们中:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>rpm-maven-plugin</artifactId>
    <version>2.1.5</version>
    <executions>
      ...
    </executions>
    <configuration combine.children="append">
      <mappings>
        <mapping>
          ... My specific mapping
        </mapping>
      </mappings>
    </configuration>
  </plugin>

但是据我所知,进入RPM的唯一映射是子级覆盖

1 个答案:

答案 0 :(得分:1)

combinary.children =“ append”标签必须在映射元素中才能正常工作

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>rpm-maven-plugin</artifactId>
    <version>2.1.5</version>
    <executions>
      ...
    </executions>
    <configuration>
      <mappings combine.children="append">
        <mapping>
          ... My specific mapping
        </mapping>
      </mappings>
    </configuration>
  </plugin>