Maven Shade Plugin

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.

Example

This example shows how to create a jmh uber-jar:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.1.1</version>
    <executions>
        <execution>
            <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
                <configuration>
                     <finalName>benchmarks</finalName>
                         <transformers>
                              <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                 <mainClass>org.openjdk.jmh.Main</mainClass>
                              </transformer>
                         </transformers>
                </configuration>
       </execution>
  </executions>
</plugin>