Questions tagged [shadowjar]

About

Shadow is an extension of the Gradle Jar task that optimizes FatJar/UberJar creation by using JarInputStream and JarOutputStream to copy file contents. This avoids the unnecessary I/O overhead of expanding jar files to disk before recombining them. Shadow provides the similar filtering, relocation, and transformation capabilities as the Maven Shade plugin.

Links

101 questions
4
votes
2 answers

Gradle clean and copy JAR file

I am building a java application with Gradle and I want to transfer the final jar file in another folder. I want to copy the file on each build and delete the file on each clean. Unfortunately, I can do only one of the tasks and not both. When I…
orestis
  • 932
  • 2
  • 9
  • 23
4
votes
1 answer

How to reference the output file of an other Gradle task as ziptree?

I have a ShadowJar and a Proguard task that produce two jar files in my Gradle build. task obfuscate(type: ProguardTask) { outjars .. } shadowJar { ... } task release(type: Jar) { from shadowJar from obfuscate classifier 'all' } My…
jabal
  • 11,987
  • 12
  • 51
  • 99
4
votes
1 answer

Include sources in fat JAR

I use Gradle for a simple Java project and would like to produce a single fat JAR, which also contains the source code. I prepared an example repository at: https://github.com/szarnyasg/gradle-shadowjar-source. I tried this build.gradle…
Gabor Szarnyas
  • 4,410
  • 3
  • 18
  • 42
4
votes
0 answers

Gradle shadowJar compile dependency

I have a gradle project. There is a root Gradle folder with two subprojects - common and application. | -common/ -build-gradle | -application/ | -build.gradle |build.gradle |settings.gradle Common Outputs a JAR file…
Pavel Pscheidl
  • 334
  • 3
  • 11
3
votes
0 answers

Check versions used inside a FatJar/ShadowJar

so since the log4j-issue hit pretty far and wide, I was wondering how to determine the currently used version inside a shadowjar. I'm creating one fat jar using com.github.jengelman's shadow v5.2 and was not able to figure out which version of log4j…
MushyPeas
  • 2,469
  • 2
  • 31
  • 48
3
votes
1 answer

How to publish a Gradle shadow jar without a shadow pom

I use the shadow jar plugin (https://github.com/johnrengelman/shadow) to create an extra jar file with all my dependencies packaged inside. I also would like to keep the default generated jar that has only my code & resources. This is pretty simple…
ItamarBe
  • 482
  • 1
  • 5
  • 12
3
votes
2 answers

Should I shadow Kotlin when writing a Gradle Plugin

I'm writing a plugin to extract some boilerplate from a selection of existing Gradle build scripts. The existing build scripts are primarily written in Groovy and compiling Java. To build my plugin I'm using the Gradle Kotlin DSL and figured I'd…
Rob Oxspring
  • 2,835
  • 1
  • 22
  • 28
3
votes
1 answer

How to specify archive classifier for shadowJar plugin in gradle 5+

Starting from version 5 gradle changed Archive Tasks behavior This breaks shadowJar task default behavior which doesn't create --all.jar artifact any more. How to revert this behavior and create *-all.jar?
radistao
  • 14,889
  • 11
  • 66
  • 92
3
votes
1 answer

Could not find kotlin-gradle-plugin for Kotlin script Gradle

build fails, classpath error: thufir@dur:~/NetBeansProjects/kotlinShadowJar$ thufir@dur:~/NetBeansProjects/kotlinShadowJar$ gradle clean FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project…
Thufir
  • 8,216
  • 28
  • 125
  • 273
2
votes
0 answers

shadowJar minimize() removes all class files

I'm using shadowJar in my Gradle-built Kotlin project and the fat jar it produces seems to work fine. When I enable minimization though, the produced jar has no class files in it. Here's how it's configured. plugins { …
Curtis
  • 536
  • 4
  • 10
2
votes
0 answers

Cannot load custom File System on Flink's shadow jar

I needed some metadata on my S3 objects, so I had to override the S3 file system provided by flink. I followed this guide to the letter and now I have a custom file system which works on my local machine, when I run my application in the IDE. Now I…
Jack
  • 57
  • 6
2
votes
1 answer

List dependencies that are going to be part of the (shadow) JAR file

I'm using the latest version (7.1.2) of the ShadowJar (Gradle) plugin to build the application's JAR. I'm trying to exclude some dependencies from the resultant JAR, so I have configured the plugin like: import…
x80486
  • 6,627
  • 5
  • 52
  • 111
2
votes
0 answers

JavaFX program can not run without admin privileges after deployment

I have developed a JavaFX program that uses a derby embedded database. I am using JDK 11.0.10, IntelliJ 2020.3.1, JavaFX 14.0.1 and Gradle 6.3. For the jar file, I use shadowJar to make a working jar file. Then, I wrap the jar file to make an .exe…
2
votes
1 answer

Shadow jar missing common java classes

I'm packaging a shadow jar of my app. The app uses kotlin and some external dependencies. All dependencies are in my jar but i get the following exception during runtime: java.lang.NoSuchMethodError: java.util.Optional.isEmpty()Z The Z at the end…
2
votes
3 answers

Kotlin-multiplatform: ShadowJar gradle plugin creates empty jar

I tried to use ShadowJar gradle pluging to pack my ktor app into fat jar. But as result of shadowJar task i get every time almost empty jar. It contains only manifest (main class is properly set). Gradle configuration (groovy): import…
marcu
  • 223
  • 4
  • 14