Skip to content

kordamp/maven-shade-ext-transformers

Repository files navigation

Maven Shade Plugin - Extra Transformers

Build Status maven shade ext transformers


Additional transformers for maven-shade-plugin. Some of the provided transformers are based on code contributed to the Gradle’s Shadow plugin originating from the Griffon codebase.

Configuration

You must add maven-shade-ext-transformers as a dependency to the the maven-shade-plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <configuration>
                <!-- configure transformers -->
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.kordamp.shade</groupId>
                    <artifactId>maven-shade-ext-transformers</artifactId>
                    <version>1.4.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Now specify transformers as needed inside the plugin’s configuration section.

Transformers

The following transformers are available in version {version}:

ServicesResourceTransformer

This transformer performs the same task as org.apache.maven.plugins.shade.resource.ServicesResourceTransformer however it exposes a configurable path property, where as the original will always transfom 'META-INF/services'.

The following example shows the configuration required for processing files in a Griffon application project

<configuration>
    <transformer implementation="org.kordamp.shade.resources.ServicesResourceTransformer">
        <path>META-INF/griffon</path>
    </transformer>
</configuration>
Table 1. Properties
Name Type Default

path

String

META-INF/services

PropertiesFileTransformer

This transformer can merge properties files using a few strategies when duplicate keys are found. It will automatically merge properties files ending with .properties using first as default merge strategy.

The following example shows the configuration required for processing files in a Griffon application project:

<configuration>
    <transformer implementation="org.kordamp.shade.resources.PropertiesFileTransformer">
        <paths>
            <path>META-INF/editors/java.beans.PropertyEditor</path>
        </paths>
    </transformer>
</configuration>
Table 2. Properties
Name Type Default Notes

mappings

List<Map<String,String>>

takes precedence over paths

paths

List<String>

mergeStrategy

String

first

valid values are first, append, latest

mergeSeparator

String

,

used when mergeStrategy = append