0x26res
0x26res

Reputation: 13902

Maven: overrides the parent pom to add mappings to the 'rpm-maven-plugin'

I have a maven project with a parent pom and many child modules. Most modules share the same rpm packaging configuration from the parent pom, but in some cases I need to override the configuration to add a mapping (I basically need to add an extra file to the rpm).

I've tried to do this in the parent 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>

And in the children:

  <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>

But so as far as I can see, the only mappings that gets into the RPM is the children override

Upvotes: 0

Views: 522

Answers (1)

0x26res
0x26res

Reputation: 13902

For it to work, the combine.children="append" tag must be in the mapping element

  <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>

Upvotes: 1

Related Questions