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

use maven shade plugin like assembly plugin

I have a pom file that builds a standalone application that leverages a variety of Spring modules, in particular it uses the integration-file module. Originally my pom file used the Maven Assembly plugin but the uber jar it created didn't run…
Jon
  • 277
  • 2
  • 12
4
votes
1 answer

Preserving timestamps on Clojure .clj files when building shaded jar via Maven Shade Plugin

When using the maven-shade-plugin to package our jar artifact that contained a few Clojure libs and some Java. We were using AOT compilation for our Clojure code. When we loaded the jar, it was having very slow load times. AOT compilation is…
Dereference
  • 78
  • 1
  • 7
4
votes
1 answer

Using maven-shade-plugin with maven-assembly-plugin

I have a project which packages several (executable jar) assemblies using the maven-assembly-plugin - basically the same code but with different sets of data for different clients. I have a need to use spring in my executable jar and due to the file…
4
votes
1 answer

How to avoid the class conflict using maven

I use the maven-shade-plugin to build a project , However, I have encounter a problem I could not handle it.there are two jars almost have the same class and the path is same,aspectjweaver.jar and aspectjrt.jar , when package the jar ,I get the…
3
votes
1 answer

Within the ecosystem of Java, Scala or Kotlin, is there a reliable way to repackage a library dependency to avoid version conflict?

This may be an old question but is still pending a solution. The entire question stemmed from a small detail in the development of Apache Spark, one of the largest open source project in history. During the delivery and release of Spark 1.x and 2.x.…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
3
votes
4 answers

Maven Shading Multi-Module Aggregation and Inheritance

Context I have an IntelliJ project with multiple modules. I am using the maven-shade-plugin to jar with dependencies whilst reducing jar size. The project structure is as follows; top-level parent (pom) (aggregates api and world-teleport) api…
Jason
  • 5,154
  • 2
  • 12
  • 22
3
votes
3 answers

Failed to get nested archive for entry BOOT-INF/lib for jar created with maven-shaded-plugin

I am using spring-boot-maven-plugin:2.1.0.RELEASE to package my main line application. This application has all common dependencies etc packaged In a separate project, I am building a shaded jar using maven-shade-plugin:2.4.3 and injecting into my…
SJunejo
  • 1,316
  • 4
  • 23
  • 39
3
votes
1 answer

Maven Shade Plugin: deploy both artifacts but make shaded one the main

I use maven shade plugin in the package phase and I want that the shaded jar becomes the main jar my-app.jar the original jar is not renamed to original-my-app.jar but a custom classifier is applied to it, in particular my-app:no-deps.jar finally…
alexlipa
  • 1,131
  • 2
  • 12
  • 27
3
votes
0 answers

ClassNotFoundException with Apache Spark and assembled Jar

I'm trying to run a Java project that uses Apache Spark. I read my data from CSV files into a dataset. If I run the code from Eclipse, everyhing works fine. I configured the project such that a single jar with all dependencies is made. If I run the…
user9642332
3
votes
1 answer

Using shaded jar as dependency causing shading in original project

My project has a dependency on another project's shaded jar. This other project is using shade plugin to relocate all classes in package a.b.c for some artifact A version 1 to shaded.a.b.c. My project also uses this artifact A but version 2. When I…
Naved Alam
  • 827
  • 9
  • 25
3
votes
1 answer

maven-shade-plugin is excluding jar that is declared as a dependency

I am using maven to package a shaded jar file. I trawled through the other posts on this, without finding an answer. I am not using provided as an element either. I include that log4j-core as a dependency in the pom.xml, but when maven-shade-plugin…
oldDave
  • 395
  • 6
  • 25
3
votes
3 answers

Shaded package tries to find java.time.LocalTime in java 7

We've got a multi-project application that runs under : maven, spring 4.2.7, spring-data-jpa 1.10.2, hibernate 5.1 Everything runs fine when running through eclipse but once we try to shade into a single jar hibernate seems to think we're in java 8…
Florian F.
  • 4,700
  • 26
  • 50
3
votes
0 answers

Specify which jar wins when conflicts in Maven Shade

I am trying to use the Maven Shade plugin to build an uber-jar. Two of my dependencies include classes with the same name, in the same package, which have different implementations. I know this is a bad idea, but I do not have control over those…
Troy Daniels
  • 3,270
  • 2
  • 25
  • 57
3
votes
1 answer

NullPointerException when using shade with minimizeJar = true

When using shade and minimizeJar I get a NullpointerException from the shade plugin. In the below example I define two dependencies; junit and commons-lang3, and in my code only make use of a single class from commons-lang3 - StringUtils. My…
beresfordt
  • 5,088
  • 10
  • 35
  • 43
3
votes
1 answer

Include dependency in maven shade plugin

I am trying to create a deploy-able jar which using Apache's commons-lang3. However my AWS cluster where my Hadoop is does not contain this library so I get a classNotFoundException. I figured I needed to manually add that dependency in but I am…
VSEWHGHP
  • 195
  • 2
  • 3
  • 12