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

529 questions
6
votes
2 answers

Resolving transitive dependency conflicts in Java

I am trying to build a Dropwizard (Jersey) REST endpoint that communicates with HBase. Although these are my only two top-level dependencies, both of these dependencies come loaded with many transitive dependencies that conflict. A simple example of…
Dmitry Minkovsky
  • 36,185
  • 26
  • 116
  • 160
6
votes
1 answer

Using Maven's shade plugin from Scala and sbt

Due to some quirks in some dependencies, I'm having trouble with sbt-assembly, and have been told that people working with Java and have had good results with Maven's shade plugin. How can I use Maven's shade plugin for Scala / sbt?
SRobertJames
  • 8,210
  • 14
  • 60
  • 107
6
votes
3 answers

Unable to shade jar with maven (INVOKESPECIAL/STATIC)

The full error message: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project --: Error creating shaded jar: INVOKESPECIAL/STATIC on interfaces require ASM 5 -> [Help 1] The jarfile which I am attempting…
Rogue
  • 11,105
  • 5
  • 45
  • 71
6
votes
1 answer

How to exclude test dependencies from a shaded maven jar?

I'm using the maven-shade-plugin and I'd like to exclude not only my test code, but my test dependencies in the shaded jar. I realize I can specifically exclude certain artifacts (like junit), but that's a good bit of work and prone to some error…
AHungerArtist
  • 9,332
  • 17
  • 73
  • 109
6
votes
1 answer

Filter resources maven-shade-plugin

I am trying to filter the resources included in my jar. I'm using shade-maven-plugin and this one is adding all the resources of all my dependencies into my generated jar, I only want to be included my project resources. Here is my pom definition: …
maqjav
  • 2,310
  • 3
  • 23
  • 35
5
votes
1 answer

Maven Shade overlapping classes warning

I am using commons-io in my project and want to shade it. I am running into a warning that I can't seem to figure out: [WARNING] commons-io-2.7.jar, murder-1.0-SNAPSHOT.jar define 180 overlapping classes and resources: ... I find this strange, as…
Vapid
  • 701
  • 7
  • 27
5
votes
2 answers

Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.0.0:shade for parameter transformer

I am trying to get the log4j2 configured for my aws lambda function using java8 runtime. Aws lambda handler does provide context-Lambdalogger but I want to use the standard log4j configuration so that it can be declared in every class and log it as…
Ashwin Dora
  • 115
  • 1
  • 12
5
votes
1 answer

Create tests jar with all the Karate dependencies

I have the following project structure. src/test/java There is no src/main folder. Above src/test/java folder contains some scala classes as well as some java classes. When i build the jar file using following plugins maven-jar-plugin : it…
5
votes
1 answer

Change log level for particular maven plugin

I want to change the log level for a particular maven plugin, ideally from within the pom.xml, less than ideal but still acceptable by a command line switch. In particular I want INFO in general but only WARN from maven-shade-plugin:3.1.0.
scravy
  • 11,904
  • 14
  • 72
  • 127
5
votes
1 answer

Maven dynamically exclude class with same name from different dependencies

There are two classes com.package.A, one coming from com.package art1 and one coming from com.package
Amit Kumar
  • 2,685
  • 2
  • 37
  • 72
5
votes
3 answers

Maven shade plugin can not find 'mainClass' exception?

There are a very strange build with maven-shade-plugin:2.4.3 in a standard maven project. It was throw can not find mainClass exception always when execute maven package command. I just simulate an maven-shade-plugin example, see below:
elkan1788
  • 97
  • 1
  • 2
  • 11
5
votes
0 answers

package relocation/rename using Maven dependency?

Package relocation/rename is a major solution for jar hell issue. But one problem that troubles me for long time is that such solution are not effective on running in IDE directly or executing maven-test, so they will still suffer from Jar hell. I'm…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
5
votes
1 answer

JAR HELL in IDE (intelliJ), mvn-test and mvn-package: how to unify dependency relocation in all settings?

Simple case for me: I'm using 2 very popular but conflicting scala libraries: Spark SQL & JSON4s. Each depends on different versions of the Jackson XML parser. Since nobody except my own program is using JSON4s, a simple solution is to migrate the…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
5
votes
1 answer

How to reference to a shaded jar in maven

I have a mavne project installed a shaded jar into local repo. in the repo, there are jar and shaded jar : myjar-1.0-shaded.jar myjar-1.0.jar myjar-1.0.pom In another maven project, I want to add dependency to that shaded jar how can I do it ? I…
John Zhao
  • 73
  • 1
  • 5
5
votes
4 answers

How do you use the maven shade plugin to include only specific classes from a dependency with scope "provided"?

I am using the maven shade plugin to package my application into a jar file. One of my dependencies is to Tomcat: org.apache.tomcat tomcat-catalina 7.0.59
Dimitar
  • 134
  • 1
  • 6