Maven Shade Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * http://maven.apache.org/plugins/maven-install-plugin/ =Internal= * Maven Plugins =Overview=")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=


* http://maven.apache.org/plugins/maven-install-plugin/
* http://maven.apache.org/plugins/maven-shade-plugin/


=Internal=
=Internal=


* [[Maven Plugin List|Maven Plugins]]
* [[Maven Plugin List#Plugins|Maven Plugins]]


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