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

How to make the gradle ShadowJar task also create sources and javadoc of its children?

I have a gradle project with 8 child projects and a configured shadowjar task to create an "all" jar. The toplevel project is setup to have dependencies to all its children, this tells shadowjar what to include: project(':') { dependencies { …
tbeernot
  • 2,473
  • 4
  • 24
  • 31
12
votes
2 answers

What are .kotlin_builtins files and can I omit them from my uberjars?

I'm working on integrating proguard to my gradle build for an application written in Kotlin. I'm finding that proguard is stripping out the Kotlin standard library (as it should in my simple Hello World program) but it's leaving a bunch of files in…
user457586
12
votes
2 answers

How can I fix missing conf files when using shadowJar and Scala dependencies?

Writing this for users who have future issues like me. Libraries that are built on the Typesafe config typically use their own reference.conf files and refer to certain configuration keys. When building a fat JAR using the Gradle shadowJAR plugin,…
crockpotveggies
  • 12,682
  • 12
  • 70
  • 140
11
votes
8 answers

ShadowJar: No value has been specified for property 'mainClassName'

In tweaking my buildfile, I seem to have encountered a bug with mainClassName: thufir@dur:~/NetBeansProjects/HelloSeleniumWorld$ thufir@dur:~/NetBeansProjects/HelloSeleniumWorld$ ./gradlew clean ShadowJar --stacktrace > Task :shadowJar…
Thufir
  • 8,216
  • 28
  • 125
  • 273
9
votes
2 answers

How to include test classes into shadowJar?

I am using shadow Gradle plugin to build JAR, containing all referenced jars inside. In my build.gradle I have only apply plugin: "com.github.johnrengelman.shadow" and jar { manifest { attributes 'Main-Class': 'MYCLASS' …
Dims
  • 47,675
  • 117
  • 331
  • 600
8
votes
1 answer

Heroku Java app crashing locally but not on the web

I have my main class: public class Main { public static void main(String[] args){ Spark.port(getHerokuAssignedPort()); get("/hello", (req, res) -> "Hello Heroku World"); } private static int getHerokuAssignedPort() { …
Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
7
votes
3 answers

gRPC UnsupportedAddressTypeException, but only when packaged with shadowJar

I have a simple gRPC client packaged in a jar by Gradle with shadowJar. When I run the main() with IntelliJ, the RPC is sent successfully. When I run it with java -jar, I get an exception: Update: I think I've determined that the same set of classes…
6
votes
1 answer

Can we build an AAR with a dependency of v3 without any risk of conflict with the client apps dependency of v2?

We want to produce an Android Archive Library (AAR) and distribute to our clients. In this Android lib we are using some third party dependencies, and we want to protect them from any version conflicts. We also do not want auto-updating of a…
Mats
  • 61
  • 3
6
votes
1 answer

how to import the ShadowJar plugin for Kotlin (Gradle) builds?

Build failed: thufir@dur:~/NetBeansProjects/kotlin_dsl$ thufir@dur:~/NetBeansProjects/kotlin_dsl$ gradle clean run > Configure project : e: /home/thufir/NetBeansProjects/kotlin_dsl/build.gradle.kts:4:12: Unresolved reference: github FAILURE:…
Thufir
  • 8,216
  • 28
  • 125
  • 273
5
votes
0 answers

Gradle: shadowJar leaves dependencies out

When trying to create a fat jar, shadowJar is leaving out a lot of dependencies. I created a build.gradle file from a working pom.xml. Maven builds a fat jar without issue. Reading through the Gradle's information about building a fat jar, the…
user2569618
  • 517
  • 3
  • 16
  • 42
5
votes
1 answer

Create multiple shadowJars for each flavor of application

I'm experimenting with gradle and trying to setup a system that builds different flavors (brands) of an application, which differ by configuration mainly. What I have so far are two versions of the build scripts - both not working. Version 1 First…
Battlefury
  • 247
  • 1
  • 4
  • 20
5
votes
2 answers

unable to set type shadowJar for gradle task

I am using gradle v3.4 and shadowjar v1.2.4. I added the following task but I get an error copied below when doing this. I added a task of type ShadowJar in order to be able to generate different jar files from the same project. Shadowjar works…
ali haider
  • 19,175
  • 17
  • 80
  • 149
4
votes
1 answer

How to merge Manifest sections with Gradle and shadowJar

What I need We package our products with Gradle and shadowJar. Some of the libraries we use, utilize individual sections in Jar Manifests, specifically attributes like Implementation-Title and Implementation-Version. These sometimes show in (the…
Patrick Peer
  • 277
  • 1
  • 9
4
votes
0 answers

How to use Proguard to shrink Gradle ShadowJar output to create minimized fat Java jar?

I want to shrink a fat jar which has been created using the Gradle shadow plugin. The reason for this is that I need to keep some classes within a specific package within the finished jar as they are used for dynamic class generation (e.g.…
John
  • 10,837
  • 17
  • 78
  • 141
4
votes
2 answers

Kotlin properties in a package relocated with Shadow do not work

I'm trying to relocate a package (OkHttp 4, to be specific) with Shadow, with the following Gradle config: apply plugin: 'java' apply plugin: 'com.github.johnrengelman.shadow' shadowJar { archiveBaseName.set('my_archive') …
Johan Halin
  • 701
  • 7
  • 10
1
2 3 4 5 6 7