Adding Resource Transformers

The default POM file supplied with the demo publication includes an empty Shade plug-in configuration that looks like this:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.2</version>
  <dependencies>
    <dependency>
      <groupId>com.escenic.widget-framework</groupId>
      <artifactId>wf-build-tools</artifactId>
      <version>${wf.version}</version>
    </dependency>
  </dependencies>
</plugin>

If you want to add a resource transformer, this is how you do it:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.2</version>
  <dependencies>
    <dependency>
      <groupId>com.escenic.widget-framework</groupId>
      <artifactId>wf-build-tools</artifactId>
      <version>${wf.version}</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <transformers combine.children="append">
          <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
            <resource>WEB-INF/classes/CustomResources.properties</resource>
          </transformer>
          <!-- more transformers can be added here if required -->
        </transformers>
      </configuration>
    </execution>
  </executions>
</plugin>

The transformers element must have a combine.children attribute set to append as shown in the example. This ensures that the additional transformers you have specified are correctly combined with the default transformers configured in the parent POM file. The transformers element may contain more than one transformer if required.

For information about the purpose of the example shown above, see Adding Resource Files.