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
3
votes
2 answers

use maven-shade-plugin, but dependency classes are not in the final jar

In my project's pom.xml I have the following dependency: com.my.library MyLib 1.0 jar ... I would…
user842225
  • 5,445
  • 15
  • 69
  • 119
3
votes
3 answers

How to define a dependency scope in maven to include a library in compile, run, test, but not in assembly/packaging?

I'm building an Apache Spark application that can both be debugged locally and deployed to cluster. To do this, I have to define its dependency to spark-core (a Java/scala library) to fulfil the following requirement. Included in in compile (other…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
3
votes
2 answers

maven-shade-plugin error: Cannot find setter, adder nor field in org.apache.maven.plugins.shade.resource.ManifestResourceTransformer for 'resource'

I was trying to run the Hello World example from Spring Boot. When I run 'mvn package' on the module I get the following error:- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project spring.boot:…
Dhiraj
  • 550
  • 6
  • 14
3
votes
1 answer

Maven Shade Plugin + Raw String

I am using shade plugin to create a jar with all its dependencies. Applying this configuration in my pom.xml it has been relatively…
telle
  • 609
  • 2
  • 6
  • 18
3
votes
1 answer

How to compile DropWizard without the Shade plugin?

I'm trying to get my DropWizard project working, but I am unable to compile it without getting a million duplicate dependency errors. The errors are caused by the Shade plugin and my com.thinkaurelius.titan plugin. Titan refuses to compile without…
cjroth
  • 173
  • 11
3
votes
1 answer

Maven shade unable to locate Spring NamespaceHandler for XML schema namespace

I've a small Spring project, that I've booted up with roo 1.2.2 I can run the main class just fine within Eclipse Juno. However when I try to run the JAR file built with mvn package, I get the following error: Exception in thread "main" …
stivlo
  • 83,644
  • 31
  • 142
  • 199
3
votes
2 answers

Creating executable JAR with Maven Shade plugin

I am having trouble making an executable jar from a simple Java program. I followed these Maven instructions and modified my pom.xml: org.apache.maven.plugins
Jean Logeart
  • 52,687
  • 11
  • 83
  • 118
2
votes
1 answer

Maven-shade-plugin has detected that some class files are present in two or more JARs

I'm trying to use the maven-shade-plugin but I get a warning: javafx-controls-18.0.1-win.jar, javafx-graphics-18.0.1-win.jar, javafx-media-18.0.1-win.jar, javafx-web-18.0.1-win.jar define 1 overlapping…
Dmitriy
  • 375
  • 1
  • 18
2
votes
1 answer

Does grpc-core work when embedded in a shaded jar?

TL;DR The grpc-core jar file doesn't work when embedded in a shaded jar but does work when placed on the classpath as a separate jar file. I can't tell if the issue is with grpc-core or grpc-netty (or grpc-netty-shaded) which seems to depend on…
Hmmmmm
  • 778
  • 9
  • 20
2
votes
0 answers

Maven child module does not inherit parents' POM properties when using Shade plugin

I have a multi-module project with a structure that goes as: -ParentModule -AggregateModule -pom.xml -ShadedModule -src -pom.xml -pom.xml So in essence, I'm trying to create a shaded jar for ShadedModule which is a…
2
votes
1 answer

Maven Shade does not include "META-INF/versions" of multi-release dependency

In our project, we create a "skinny" jar, which only includes our own application code and we use maven shade plugin to create the JARs for the dependencies we need to run the application. Maven shade is used to package multiple dependencies into…
Robert P
  • 9,398
  • 10
  • 58
  • 100
2
votes
0 answers

Scala classes not getting included in fat Jar using Maven Shaded plugin

I have a multimodule scala maven project with below hierarchy: MyProject: | ----pom.xml -------> Parent pom ---Module 1     |     --------------pom.xml --> Child pom 1     --------------src/main/scala     --------------src/test ----Module…
2
votes
2 answers

How to add DefaultImplementationEntries to MANIFEST when using maven-shade-plugin?

Found this question about adding a version to manifest.mf: How do I add an Implementation-Version value to a jar manifest using Maven?, but how to add them when using shade plugin? I tried with the maven-shade-plugin:
Wortig
  • 963
  • 2
  • 11
  • 37
2
votes
1 answer

Maven shade plugin fails on updating Spring Boot version to 2.4.0 from 2.3.3

I just updated the Spring Boot version in my project from 2.3.3 to 2.4.0. For a module in my project I use maven-shade-plugin with a simple shade goal, no configuration. When I was using Spring Boot 2.3.3 everything went well. With this update to…
Dragos Roban
  • 479
  • 2
  • 11
  • 20
2
votes
1 answer

How to "exclude" dependencies embedded in an uber-jar using Maven 3?

I have an a project A that has a "managed dependency" a. a is a "shaded jar" (uber-jar) with another dependency b relocated within. The problem is that the version of b relocated into a has several >7.5 CVE's filed against it and I would like to…
Reuben Peter-Paul
  • 1,550
  • 3
  • 15
  • 25