Usage

Creating a Shaded JAR

The goals for the Shade Plugin are bound to the package phase in the build lifecycle.

  1. mvn package

Configuring Your Shade Plugin

  1. <project>
  2. ...
  3. <build>
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-shade-plugin</artifactId>
  8. <version>3.0.0</version>
  9. <configuration>
  10. <!-- put your configurations here -->
  11. </configuration>
  12. <executions>
  13. <execution>
  14. <phase>package</phase>
  15. <goals>
  16. <goal>shade</goal>
  17. </goals>
  18. </execution>
  19. </executions>
  20. </plugin>
  21. </plugins>
  22. </build>
  23. ...
  24. </project>

Resource Transformers

Transformers in org.apache.maven.plugins.shade.resource
ApacheLicenseResourceTransformer Prevents license duplication
ApacheNoticeResourceTransformer Prepares merged NOTICE
AppendingTransformer Adds content to a resource
ComponentsXmlResourceTransformer Aggregates Plexus components.xml
DontIncludeResourceTransformer Prevents inclusion of matching resources
IncludeResourceTransformer Adds files from the project
ManifestResourceTransformer Sets entries in the MANIFEST
ServicesResourceTransformer Merges META-INF/services resources
XmlAppendingTransformer Adds XML content to an XML resource

For more information, see samples.