Maven Shade Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:


=Overview=
=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|jmh]] uber-jar:
<syntaxhighlight lang='xml'>
<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>
</syntaxhighlight>

Latest revision as of 20:05, 6 April 2018

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>