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
1
vote
1 answer

Gradle: shade guava without losing transitive dependencies

I have a multi-module Gradle project. One module (A) contains database-related classes; another (B) contains Spark applications and depends on A. Spark depends on Guava 14.x. My database classes depend on Guava 28.x. I need to be able to use Guava…
1
vote
1 answer

Fat jar problem with Ktor and Kotlin multiplatform

I have a kotlin multiplatform project targeting Android and iOS and recently integrated ktor so that the shared library can load web resources. It's working on iOS, but on Android I get this error: java.lang.NoClassDefFoundError: Failed resolution…
vortek
  • 474
  • 2
  • 14
1
vote
0 answers

Configure shadow plugin to build a fat jar of only dependencies

Is it possible to configure the shadow plugin to build an uber jar with only the dependencies of a project? Ideally I would like to run ./gradlew shadowJar and have it produce two jars within my build/libs/ folder - 1) A slim jar with just the…
user3097590
  • 131
  • 6
1
vote
0 answers

Control tertiary jar access to shaded classes

I have a project that has two dependencies that both have tertiary dependencies on different version of Guava; 14.0.1 and 18 14.0.1 is available as provided, and I have bundled version 18 in my uber jar and shaded it to relocate the problematic…
user1111284
  • 886
  • 1
  • 6
  • 23
1
vote
1 answer

Is it possible to hide a dependency that is located inside 'libs' folder in aar?

To give you the context of what I want to accomplish I will describe my project structure first: Application | | - Library Module | | | | - Core Library Module | | Module 1 | |- Jar dependency 1 | | | | Module 2 | …
acabezas
  • 731
  • 1
  • 7
  • 20
1
vote
0 answers

Why to depend on shadow jar?

I've been reading gradle shadow plugin documentation and found that it allows one project to depend on shadowed jar of another project dependencies { compile project(path: 'api', configuration: 'shadow') } I'm now curious what are use cases for…
Yaroslav
  • 4,543
  • 5
  • 26
  • 36
1
vote
1 answer

Getting duplicate entries exception when adding shadow generated jars in my project

I am using the shadow plugin for Gradle to generate modified jars for Dagger 2. The jar files are generated as expected, but when I add the jars as dependencies to my proyect i get Error:Execution failed for task…
acabezas
  • 731
  • 1
  • 7
  • 20
0
votes
1 answer

Gradle Shadow plugin dependencies are not detected at runtime

I am building a mod jar. I need an external library to be included in the final jar (org.apache.httpcomponents:httpasyncclient:4.1.5). I am using the Shadow plugin to make the fat jar. However, I cannot get the dependencies to be included…
0
votes
1 answer

How to remove com.jackson.databind packages from the ehcache-2.10.6.jar

We have ehcache-2.10.6.jar jar in our dependecies. It contains com.jackson.databind package that has marked as vulnerable by Trivy. No ehcache versions have non-vulnerable com.jackson.databind. How we can shade or repackage the jar to make it…
Eljah
  • 4,188
  • 4
  • 41
  • 85
0
votes
0 answers

Is it possible to relocate all packages excluding the only one without specifying all

As I can see ConfigureShadowRelocation task does not support excludes. ShadowJar task does not support patterns in relocate method. I use version 7.1.2. Is there a way to do a bulk relocation with excludes? Maybe I missed something. UPD: Here is an…
0
votes
1 answer

Gradle add compileClasspath to configurations in ShadowJar (kotlin)

Shadowjar's docs say to do this: shadowJar { configurations = [project.configurations.compileClasspath] } This appears to be in Groovy. If I run this in my Kotlin based gradle project, I get the following error: Type mismatch: inferred type is …
DWR
  • 888
  • 1
  • 8
  • 15
0
votes
1 answer

Spring boot & jpa no 'org.hibernate.ejb.HibernateEntityManagerFactory' available

There is a SpringBoot & JPA based web project developed in Intellij IDEA. It can be run in IDEA debugger correctly, but when packaged with gradle using plugin shadow (com.github.johnrengelman.shadow) and run in local console, it causes an exception…
0
votes
1 answer

Open API documentation of Springboot based REST apis fail with ApplicationContextException. The project is built with gradlew shadow plugins

I am trying to add open api documentation to springboot base REST api project that I have. It works fine when run locally inside intelliJ IDE or with gradlew run/bootRun But when the project is packaged as a fat jar using gradlew shadow plugin…
0
votes
1 answer

kotlin multiplatform shadow fat jar and runShadow task?

I have a fairly standard kotlin multiplatform (mpp) build.gradle.kts that uses application plugin and com.github.johnrengelman.shadow I succeeded to create an java -jar executable fat jar: new solution: EDIT: I extended a line to @Pylyp Dukhov…
0
votes
2 answers

Exclude dependency from pom using Maven Publish Plugin?

I use the following plugins: id 'maven-publish' id "com.github.johnrengelman.shadow" version "7.0.0" my dependencies: dependencies { shadow gradleApi() shadow localGroovy() implementation 'com.example:lib:0.1.0' my publishing…
pixel
  • 24,905
  • 36
  • 149
  • 251