Shadow is a Gradle plugin that merges project dependencies into one JAR, relocates packages, transforms files, and can optimize with R8 or ProGuard.
Overview
Shadow plugs into Gradle builds to combine dependency classes and resources into a single output JAR, often called a fat or uber JAR. It processes dependent libraries through jar streams so contents are merged without unpacking everything to disk first.
Two common goals are shipping a runnable application as one archive with a manifest main class started via java -jar, and bundling library dependencies while relocating package names to reduce classpath conflicts when downstream projects use the same libraries at different versions.
The plugin is maintained under the GradleUp organization with plugin ID com.gradleup.shadow, superseding the older com.github.johnrengelman.shadow identifier. Documentation covers user guides, change logs, and a compatibility matrix tying Shadow releases to minimum Gradle and Java versions.
Shadow is presented as the Gradle-side analogue to Maven’s Shade Plugin for similar packaging and relocation tasks.
Key features
- Fat and uber JAR creation
- Dependency package relocation
- File transforms during merge
- R8 and ProGuard optimization
- Executable JAR manifest support
- Stream-based jar merging
- Library classpath conflict mitigation
- GradleUp plugin distribution
Use cases
- Single-jar application releases
- Shaded libraries for Maven consumers
- Relocating conflicting dependencies
- Gradle Java and Kotlin packaging