Questions tagged [maven-shade-plugin]

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

Sources : http://maven.apache.org/plugins/maven-shade-plugin/index.html

Goals Overview

The Shade Plugin has a single goal:

shade:shade is bound to the package phase and is used to create a shaded jar.

Usage

General instructions on how to use the Shade Plugin can be found on the usage page. Some more specific use cases are described in the examples given below. Last but not least, users occasionally contribute additional examples, tips or errata to the plugin's wiki page.

In case you still have questions regarding the plugin's usage, please feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.

If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.

Official site : http://maven.apache.org/plugins/maven-shade-plugin/

Maven Repository site : https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin

471 questions
311
votes
4 answers

What is the maven-shade-plugin used for, and why would you want to relocate Java packages?

I found the maven-shade-plugin being used in someone's pom.xml. I've never used maven-shade-plugin before (and I'm a Maven n00b) so I tried to understand the reason for using this and what it does. I looked at the Maven docs, however I can't…
nonbeing
  • 5,809
  • 6
  • 28
  • 41
90
votes
3 answers

What is the purpose of dependency-reduced-pom.xml generated by the shade plugin?

I read over the docs and didn't find anything that talks about what it's used for.
Transcendence
  • 2,226
  • 2
  • 18
  • 31
64
votes
5 answers

Maven shade plugin adding dependency-reduced-pom.xml to base directory

The maven shade plugin is creating a file called dependency-reduced-pom.xml and also artifactname-shaded.jar and placing them in the base directory. Is this a bug? Should be in the target directory. Any workaround?
DD.
  • 19,793
  • 49
  • 140
  • 237
34
votes
2 answers

Invalid or corrupt JAR File built by Maven shade plugin

After adding the Maven jFree dependency to my existing application, I'm not able to execute the created jar. The only error message I get is the following: java -jar target/com.company.product-1.0.0-SNAPSHOT.jar Error: Invalid or corrupt jarfile…
d0x
  • 9,378
  • 14
  • 58
  • 93
33
votes
1 answer

What is a shaded jar? And what is the difference/similarities between uber jar and shaded jar?

Can you please help explain what is a shaded jar and how is the maven-shade-plugin useful? Also what is an uber jar.
user3478709
  • 343
  • 1
  • 3
  • 7
33
votes
1 answer

Is dependency-reduced-pom.xml automatically used instead of pom.xml?

Is dependency-reduced-pom.xml created by Maven shade plugin automatically used in projects that depends on the uberjar (instead of the ordinary pom.xml)? Asking this after reading a number of dependency-reduced-pom.xml related questions and haven't…
Johnny
  • 10,849
  • 11
  • 61
  • 105
32
votes
6 answers

How to create spring-based executable jar with maven?

I have a Maven based Spring-WS client project that I want to package as a single jar. In eclipse, everything runs properly. When I try to package it as an executable jar, I get ClassNotFound exceptions since the Spring jars are not included in my…
Eric B.
  • 20,257
  • 43
  • 147
  • 269
32
votes
2 answers

How to include test classes in Jar created by maven-shade-plugin?

I'm trying to package my test classes in to an executable jar with dependencies using Maven, but I'm struggling to get this right. This is my pom.xml so far: 4.0.0 com.c0deattack
C0deAttack
  • 23,507
  • 18
  • 68
  • 79
31
votes
4 answers

Log4j2 configuration not found when running standalone application built by shade plugin

I have application which when I run from maven log4j2 it is working: mvn exec:java -Dexec.args=... but when I run jar as standalone application then it shows error: java -jar log: ERROR StatusLogger Unrecognized format specifier [d] ERROR…
hudi
  • 13,245
  • 40
  • 125
  • 230
30
votes
8 answers

Maven build [WARNING] we have a duplicate class

Anybody has any idea what happened to my maven build? I am getting a lot of duplicate warnings. [WARNING] We have a duplicate org/apache/commons/logging/impl/LogFactoryImpl$1.class in…
Shengjie
  • 10,598
  • 26
  • 89
  • 133
28
votes
4 answers

log4j2 ERROR StatusLogger Unrecognized conversion specifier

I have log4j2 in my project when I run main method in intellij Idea ,it correct to print log. when i use maven-shade-plugin package project to jar file, and run jar as standalone application it shows error: java -cp package.jar…
CoderMeng
  • 381
  • 1
  • 3
  • 5
25
votes
2 answers

Maven shade plugin warning: we have a duplicate - how to fix?

This is my project POM (link to the paste, so you can right click > save as pom.xml)
Raffaele
  • 19,761
  • 5
  • 42
  • 81
24
votes
1 answer

Maven - How to remove module-info.class warning for shaded .jar?

So here's my problem... I'm packaging a Spring Boot app into an uber jar using the maven-shade plugin. Simple, right? Well, it is except as of recently I'm getting the following warning at the end of mvn clean package: [WARNING] Discovered…
18
votes
2 answers

Is there a maven archtype for creating a console app?

Is it possible to generate a maven stub project via mvn archetype:generate that has a main function, and part of the build process includes making a App.cmd/App.sh to run the app from a shell? It seems that I need the maven-shade-plugin to create a…
Justin Dearing
  • 12,753
  • 19
  • 80
  • 146
18
votes
2 answers

How can I tell which signed jar is causing maven-shade-plugin to fail?

To run maven-shade-plugin, I have to use to method described here due to signed dependencies, as shown here: maven-shade-plugin package
jordanpg
  • 6,026
  • 3
  • 38
  • 65
1
2 3
31 32