Questions tagged [gradle-shadow-plugin]

A Gradle plugin for collapsing all dependencies and project code into a single Jar file.

Shadow is a port of the Maven Shade plugin to Gradle. It allows Gradle to create a Jar artifact containing the contents of all dependencies. Existing infrastructure from Shade is kept where possible in order to support configuration as close to the Maven syntax as possible.

Link to Github repo here

Link to Gradle Plugin page here

53 questions
2
votes
1 answer

Building Spark fat jar with Gradle: shadow plugin yields corrupted JAR file

I am trying to build a Spark fat jar with Gradle. The build succeeds but a file comes out corrupted in a subtle way: trying to run it yields: Error: Could not find or load main class shadow_test.Main Caused by: java.lang.ClassNotFoundException:…
Sasha O
  • 3,710
  • 2
  • 35
  • 45
2
votes
1 answer

java.nio.file.NoSuchFileException : Uber Jar not able to locate src/main/resources folder files

I am building uber jar using gradle build and the plugin I have used is https://github.com/johnrengelman/shadow I have a json file in my src/main/resources folder which i am using in the code in below way public Repository
SRJ
  • 2,092
  • 3
  • 17
  • 36
2
votes
1 answer

Gradle Shadow Plugin dependencies not present in runtimeClasspath

I configure dependency using shadow scope added by Gradle Shadow Plugin: dependencies { shadow "org.apache.flink:flink-java:$flinkVersion" } As per documentation, this dependency should not be present in shadow JAR (which is true), it should be…
Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
2
votes
1 answer

Multiple dependency versions with Gradle 5

I need to support 2 different versions of the same library (to support a legacy version), es4hadoop for Apache Spark. Version 6.2.2(https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch-spark-13_2.10/6.2.2) Version 6.3.2…
Thomas Decaux
  • 21,738
  • 2
  • 113
  • 124
2
votes
0 answers

How does gradle shadow plugin deal with OSGi structures?

I'm using the shadow plugin in gradle build process to package an uber jar for my executable. However, this involves datanucleus which is OSGi structured. When I use shadowJar task in gradle, the plugin.xml is lost. Does the gradle shadow plugin has…
totoromeow
  • 2,199
  • 4
  • 19
  • 19
2
votes
0 answers

Android Studio Not Seeing Dependency (but Gradle does!)

I have built a pure java library, and have compiled two versions, one shadowed (using the gradle shadow plugin), one not, and deployed them to my local nexus repository. In my Android Library project, I've created two productFlavors, standard and…
Mark
  • 2,362
  • 18
  • 34
2
votes
1 answer

Gradle copy folder on installDist

Using gradle 3.4 but fairly new to it. If I run gradlew installDist the files in src/main/java get copied to the build folder all that works fine. But I also have an extra folder in src/main/conf I would like to copy over to…
user432024
  • 4,392
  • 8
  • 49
  • 85
2
votes
1 answer

How to alter dependencies for a generated artifact?

Gradle 2.3; shadow plugin 1.2.1. In my build.gradle, I use the shadow plugin in order to repackage a dependency, like such: shadowJar { relocate("com.google.common", "r.com.google.common"); } I also add the shadow jar to the list of artifacts…
fge
  • 119,121
  • 33
  • 254
  • 329
2
votes
1 answer

Spring-boot Gradle shadow jar plugin | missing EmbeddedServletContainerFactory

I setup up a simple web project in spring boot with only the compile("org.springframework.boot:spring-boot-starter-web") dependency . When I used gradlew bootRun, the application starts up and I am able to get the webpage. If a fat jar is created…
Vinod R
  • 1,218
  • 10
  • 13
1
vote
2 answers

Project unable to find gradle shadow plugin

I have a project that builds a lib. I want to make a fat jar for packaging. I followed instructions in the gradle-shadow-plugin docs Here is my build.gradle buildscript { repositories { jcenter() mavenCentral() …
feroze
  • 7,380
  • 7
  • 40
  • 57
1
vote
0 answers

How to configure a Shadow Plugin fat jar to bundle and access web.xml and context.xml locations?

I have a Tomcat Embedded project that I want to run using a fat jar with Shadow Plugin My Gradle in build.gradle.kts configuration looks like this for the parts related to Shadow: plugins { ... id("com.github.johnrengelman.shadow") version…
buzoherbert
  • 1,537
  • 1
  • 12
  • 34
1
vote
0 answers

Renaming file in jar via Gradle

I have a jar task (well a ShadowJar, but that shouldn't matter I think). named("shadowJar") { archiveClassifier.set("") duplicatesStrategy =…
Wyvest
  • 11
  • 1
1
vote
0 answers

Gradle shadowjar packages all submodules into a single jar

Original issue: https://github.com/johnrengelman/shadow/issues/744 I recently converted my project to a multi-module project, but I'm having trouble using shadowjar's minimize feature. Here is my project structure: Root project…
RE_OVO
  • 93
  • 1
  • 6
1
vote
1 answer

Gradle : java.lang.ClassNotFoundException : When running Uber Jar

I am trying to build uber jar in java with gradle version 6.0 and it builds fine. But when i run Uber Jar, it throws me following error root@9393134c8941:/home/gradle/checkout-service# java -jar…
SRJ
  • 2,092
  • 3
  • 17
  • 36
1
vote
0 answers

Gradle Shadow Duplicate File Names in Jar

I'm trying to migrate from an Ant build to a Gradle build. I am using Shadow (com.github.jengelman.gradle.plugins:shadow:5.2.0) to build my project. My project includes 3 Apache Axiom dependencies: implementation group:…
mandelbug
  • 1,548
  • 5
  • 20
  • 32