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
5
votes
1 answer

Problems with using log4j in the shaded jar

I have the following situation in my project: a large module (call it converter) with its own dependencies is being integrated into the main application (which has been developed separately by different people and has its own, partially…
shekvl
  • 51
  • 1
  • 4
5
votes
2 answers

Refactoring import statements using Shade relocations in Maven

I've been using Shade to relocate a dependency from com.package.x to com.package.y; when I build with Maven, it complains due to incompatible types - so I have to change my import statements inside my code to match com.package.y. Is this really the…
whitfin
  • 4,539
  • 6
  • 39
  • 67
5
votes
0 answers

Maven modify dependency jar manifest files

I'm sorry in advance I can't give the exact code as I don't have it at hand right now. However, I ran into a problem while trying to package my project into a jar. I used maven assembly plugin in my pom.xml to assemble all dependencies and project…
J R
  • 223
  • 3
  • 12
5
votes
1 answer

maven-shade-plugin : how to turn off compression?

I just tried the Shade plugin, but generated jar is always compressed. How to turn off the jar compression ? Here's the pom: org.apache.maven.plugins
4
votes
1 answer

How to run maven integration tests on shaded artifact?

I have a simple goal: I want to be able to use the maven-failsafe-plugin, or any viable alternative, to run tests against a jar I'm building with the maven-shade-plugin. Specifically, I want to run the tests after shade runs because I want an…
4
votes
3 answers

ClassNotFound exception while using the Maven Shade Plugin

I am trying to follow this link: http://maven.apache.org/plugins/maven-shade-plugin/examples.html I am new to Maven. I feel a bit out of depth trying to follow the example. I am able to get Quartz Scheduler to get working with Spring. I want to be…
user244333
4
votes
2 answers

What have caused the problem of "Could not find netty-transport-native-epoll-4.1.76.Final-linux-x86_64.jar"?

I'm using Gradle shadow jar plugin to produce a fat jar for selenium. The following code is declared in Gradle kts: dependencies { val seleniumV = "4.1.4" val phantomJSV = "1.5.0" val htmlUnitV = "3.61.0" // Selenium …
tribbloid
  • 4,026
  • 14
  • 64
  • 103
4
votes
0 answers

From shading to modules: How to avoid version conflicts?

My context is that I have written a java library that does something "useful" and this library is (as is common for libraries) to be used in other applications. Among other things my library uses Antlr 4 to generate part of the code. Key thing here…
4
votes
1 answer

log4j2 JsonTemplateLayout not working with maven shade plugin

i am trying to generate logs in Json format for that using log4j2 JsonTemplateLayout with LogstashJsonEventLayoutV1.json as the template. When i run the code using intellij everything works as expected. But using java -jar command it fails…
samik
  • 93
  • 7
4
votes
1 answer

In a multi-module maven project, can I make a module to calculate transitive dependencies based on the DependencyReducedPom of another module?

This appears to be a simple question but I found it difficult due to maven's extremely rigorous paradigm of lifecycles and phases: Assuming that in a multi-module maven project, several plugins are used in various phases to rewrite the pom.xml to…
4
votes
0 answers

What does maven-shade-plugin "minimizeJar" configuration do?

I cannot find a description of how the maven-shade-plugin minimizeJar option do filter out classes. In the doc it only say: Besides user-specified filters, the plugin can also be configured to automatically remove all classes of dependencies that…
Juh_
  • 14,628
  • 8
  • 59
  • 92
4
votes
1 answer

Can't shade ND4j into a jar

So, I've been trying to integrate deeplearning4j(DL4j) in my Minecraft plugin and so far it's going very well. The only problem I have is shading into the jar. I successfully shaded dl4j in it but can't seem to put nd4j in it which is a library that…
Antony
  • 41
  • 1
  • 2
4
votes
1 answer

Maven shade plugin -Failed to execute goal

I have been trying to rename tika app class. There are loading conflicts due to duplicate classes on the class path. When I try and run maven install -e, it throwing the error and I want to use the org.apache.tika class as com.test1.tika The…
Santhosh
  • 431
  • 5
  • 16
4
votes
0 answers

Prevent maven-shade-plugin from exposing dependency?

Thanks to a separate thread, I realized my project's uber-jar had a bug. I create the uber-jar using maven-shade-plugin because I need the more advanced transformer capabilities to merge several ServiceLoader definitions. So, the issue is that my…
Kyle Moore
  • 41
  • 4
4
votes
0 answers

Maven shade plugin: How can I shade transitive dependencies of 3rd party dependency

Input I am developing an infrastructure that uses Kafka Clients 0.11 (KC-0.11). KC-0.11 has it's own dependencies off course. Project X aims to use my infra. Project X also uses a different infra which uses Kafka Client 0.8 (KC-0.8). Obviously,…
aviad cohen
  • 637
  • 1
  • 6
  • 16