├── changelog
├── @unreleased
│ └── .gitkeep
├── 1.0.0
│ └── pr-1.v2.yml
├── 1.0.2
│ └── pr-14.v2.yml
├── 2.1.0
│ └── pr-155.v2.yml
├── 3.0.0
│ └── pr-411.v2.yml
├── 2.6.0
│ └── pr-332.v2.yml
├── 3.1.0
│ └── pr-552.v2.yml
├── 2.0.0
│ └── pr-137.v2.yml
├── 2.8.0
│ └── pr-362.v2.yml
├── 1.0.1
│ └── pr-10.v2.yml
├── 1.3.2
│ └── pr-77.v2.yml
└── 1.3.1
│ └── pr-74.v2.yml
├── gradle
├── gradle-daemon-jdk-version
├── jdks
│ ├── 17
│ │ ├── macos
│ │ │ ├── aarch64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ │ └── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ ├── windows
│ │ │ └── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ ├── linux-glibc
│ │ │ ├── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ │ └── aarch64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ └── linux-musl
│ │ │ ├── aarch64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ │ └── x86-64
│ │ │ ├── local-path
│ │ │ └── download-url
│ ├── 21
│ │ ├── macos
│ │ │ ├── aarch64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ │ └── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ ├── windows
│ │ │ └── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ ├── linux-glibc
│ │ │ ├── aarch64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ │ └── x86-64
│ │ │ │ ├── local-path
│ │ │ │ └── download-url
│ │ └── linux-musl
│ │ │ ├── aarch64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ │ └── x86-64
│ │ │ ├── local-path
│ │ │ └── download-url
│ └── 25
│ │ ├── macos
│ │ ├── aarch64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ └── x86-64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ ├── windows
│ │ └── x86-64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ ├── linux-glibc
│ │ ├── aarch64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ └── x86-64
│ │ │ ├── local-path
│ │ │ └── download-url
│ │ └── linux-musl
│ │ ├── aarch64
│ │ ├── local-path
│ │ └── download-url
│ │ └── x86-64
│ │ ├── local-path
│ │ └── download-url
├── gradle-test-versions.yml
├── gradle-jdks-setup.jar
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle-jdks-setup.sh
└── gradle-jdks-functions.sh
├── .circleci
├── template.sh
├── .gitattributes
└── config.yml
├── src
├── main
│ ├── resources
│ │ └── META-INF
│ │ │ └── gradle-plugins
│ │ │ └── com.palantir.shadow-jar.properties
│ └── java
│ │ └── com
│ │ └── palantir
│ │ └── gradle
│ │ └── shadowjar
│ │ ├── JarFilesRelocator.java
│ │ └── ShadowJarPlugin.java
└── test
│ └── java
│ └── com
│ └── palantir
│ └── gradle
│ └── shadowjar
│ └── ShadowJarPluginIntegrationTest.java
├── .changelog.yml
├── settings.gradle
├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── stale.yml
├── .bulldozer.yml
├── gradle.properties
├── .excavator.yml
├── .gitignore
├── .baseline
├── copyright
│ └── 001_apache-2.0.txt
├── eclipse
│ ├── dynamic
│ │ └── dotfile.checkstyle
│ ├── static
│ │ └── dotfile.settings
│ │ │ └── org.eclipse.jdt.ui.prefs
│ └── org.eclipse.jdt.core.prefs
├── checkstyle
│ ├── checkstyle-suppressions.xml
│ └── checkstyle.xml
└── idea
│ └── intellij-java-palantir-style.xml
├── versions.props
├── gradlew.bat
├── README.md
├── versions.lock
├── gradlew
└── LICENSE
/changelog/@unreleased/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gradle/gradle-daemon-jdk-version:
--------------------------------------------------------------------------------
1 | 21
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/macos/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/macos/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/windows/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/macos/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/macos/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/windows/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.10.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/macos/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.8.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/macos/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.8.1
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/windows/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.8.1
2 |
--------------------------------------------------------------------------------
/gradle/gradle-test-versions.yml:
--------------------------------------------------------------------------------
1 | major-versions:
2 | 8: 8.14.3
3 | 9: 9.2.1
4 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-glibc/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1-glibc
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-musl/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-musl/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-glibc/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.11.1-glibc
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-glibc/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.11.1-glibc
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-musl/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.11.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-musl/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-21.0.9.11.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-glibc/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.9.1-glibc
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-glibc/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.9.1-glibc
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-musl/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.9.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-musl/x86-64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-25.0.1.9.1-musl
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-glibc/aarch64/local-path:
--------------------------------------------------------------------------------
1 | amazon-corretto-17.0.17.10.1-glibc
2 |
--------------------------------------------------------------------------------
/.circleci/template.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | export CIRCLECI_TEMPLATE=java-library-oss
3 | export JDK=11
4 |
--------------------------------------------------------------------------------
/gradle/gradle-jdks-setup.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/palantir/gradle-shadow-jar/HEAD/gradle/gradle-jdks-setup.jar
--------------------------------------------------------------------------------
/.circleci/.gitattributes:
--------------------------------------------------------------------------------
1 | # Mark .circleci/config.yml as generated for github reviews
2 | config.yml linguist-generated=true
3 |
--------------------------------------------------------------------------------
/changelog/1.0.0/pr-1.v2.yml:
--------------------------------------------------------------------------------
1 | type: feature
2 | feature:
3 | description: Initial release of the project
4 | links: []
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/palantir/gradle-shadow-jar/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/jdks/21/macos/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/macos/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-macosx-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/changelog/1.0.2/pr-14.v2.yml:
--------------------------------------------------------------------------------
1 | type: fix
2 | fix:
3 | description: Shaded dependencies are now accessible in test source sets.
4 | links: []
5 |
--------------------------------------------------------------------------------
/gradle/jdks/17/macos/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-glibc/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/macos/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-macosx-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/windows/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.10.1/amazon-corretto-21.0.9.10.1-windows-x64-jdk.zip
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-glibc/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/macos/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-macosx-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/windows/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.8.1/amazon-corretto-25.0.1.8.1-windows-x64-jdk.zip
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-glibc/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/macos/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-macosx-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/windows/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-windows-x64-jdk.zip
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-glibc/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-glibc/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-musl/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-alpine-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-glibc/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-musl/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-musl/x86-64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-x64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/25/linux-musl/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/25.0.1.9.1/amazon-corretto-25.0.1.9.1-alpine-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/17/linux-musl/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/17.0.17.10.1/amazon-corretto-17.0.17.10.1-alpine-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/gradle/jdks/21/linux-musl/aarch64/download-url:
--------------------------------------------------------------------------------
1 | https://corretto.aws/downloads/resources/21.0.9.11.1/amazon-corretto-21.0.9.11.1-alpine-linux-aarch64.tar.gz
2 |
--------------------------------------------------------------------------------
/changelog/2.1.0/pr-155.v2.yml:
--------------------------------------------------------------------------------
1 | type: improvement
2 | improvement:
3 | description: Do not shade safe logger
4 | links:
5 | - https://github.com/palantir/gradle-shadow-jar/pull/155
6 |
--------------------------------------------------------------------------------
/changelog/3.0.0/pr-411.v2.yml:
--------------------------------------------------------------------------------
1 | type: break
2 | break:
3 | description: Support Gradle 8. Drop support for Gradle 7.
4 | links:
5 | - https://github.com/palantir/gradle-shadow-jar/pull/411
6 |
--------------------------------------------------------------------------------
/changelog/2.6.0/pr-332.v2.yml:
--------------------------------------------------------------------------------
1 | type: improvement
2 | improvement:
3 | description: No longer shade tracing or metric classes
4 | links:
5 | - https://github.com/palantir/gradle-shadow-jar/pull/332
6 |
--------------------------------------------------------------------------------
/changelog/3.1.0/pr-552.v2.yml:
--------------------------------------------------------------------------------
1 | type: fix
2 | fix:
3 | description: exclude shaded configuration from checkUnusedConstraints task
4 | links:
5 | - https://github.com/palantir/gradle-shadow-jar/pull/552
6 |
--------------------------------------------------------------------------------
/changelog/2.0.0/pr-137.v2.yml:
--------------------------------------------------------------------------------
1 | type: break
2 | break:
3 | description: Fix Gradle 7 compatibility. Increase minimum required Gradle version
4 | to 7.0.
5 | links:
6 | - https://github.com/palantir/gradle-shadow-jar/pull/137
7 |
--------------------------------------------------------------------------------
/changelog/2.8.0/pr-362.v2.yml:
--------------------------------------------------------------------------------
1 | type: improvement
2 | improvement:
3 | description: ServiceLoader service providers within shaded modules work as expected
4 | links:
5 | - https://github.com/palantir/gradle-shadow-jar/pull/362
6 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/gradle-plugins/com.palantir.shadow-jar.properties:
--------------------------------------------------------------------------------
1 | #
2 | # (c) Copyright 2019 Palantir Technologies Inc. All rights reserved.
3 | #
4 |
5 | implementation-class=com.palantir.gradle.shadowjar.ShadowJarPlugin
6 |
--------------------------------------------------------------------------------
/.changelog.yml:
--------------------------------------------------------------------------------
1 | # Excavator auto-updates this file. Please contribute improvements to the central template.
2 |
3 | # This file is intentionally empty. The file's existence enables changelog-app and is empty to use the default configuration.
4 |
--------------------------------------------------------------------------------
/changelog/1.0.1/pr-10.v2.yml:
--------------------------------------------------------------------------------
1 | type: fix
2 | fix:
3 | description: Fix a bug where classes that are excluded from shading still that their
4 | references rewritten to use the shaded versions, which would produce broken jars.
5 | links: []
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/changelog/1.3.2/pr-77.v2.yml:
--------------------------------------------------------------------------------
1 | type: fix
2 | fix:
3 | description: Previously, projects that shaded multi-release jars may have had an
4 | empty line in the middle of their manifest, which would prevent the manifest from
5 | being parsed. This has been removed.
6 | links:
7 | - https://github.com/palantir/gradle-shadow-jar/pull/77
8 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | gradlePluginPortal()
5 | }
6 | dependencies {
7 | classpath 'com.palantir.gradle.jdks:gradle-jdks-settings:0.71.0'
8 | }
9 | }
10 | apply plugin: 'com.palantir.jdks.settings'
11 | rootProject.name = 'gradle-shadow-jar'
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## What happened?
2 |
3 |
7 |
8 | ## What did you want to happen?
9 |
10 |
13 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Before this PR
2 |
3 |
4 | ## After this PR
5 |
6 | ==COMMIT_MSG==
7 | ==COMMIT_MSG==
8 |
9 | ## Possible downsides?
10 |
11 |
12 |
--------------------------------------------------------------------------------
/changelog/1.3.1/pr-74.v2.yml:
--------------------------------------------------------------------------------
1 | type: fix
2 | fix:
3 | description: '`shadowJar` now depends on the `jar` task in order to trigger tasks
4 | like `configureProductDependencies` from `com.palantir.sls-recommended-dependencies`
5 | which modify the `jar` manifest, so that these `manifest` changes are inherited
6 | by default in `shadowJar`.'
7 | links:
8 | - https://github.com/palantir/gradle-shadow-jar/pull/74
9 |
--------------------------------------------------------------------------------
/.bulldozer.yml:
--------------------------------------------------------------------------------
1 | # Excavator auto-updates this file. Please contribute improvements to the central template.
2 |
3 | version: 1
4 | merge:
5 | trigger:
6 | labels: ["merge when ready"]
7 | ignore:
8 | labels: ["do not merge"]
9 | method: squash
10 | options:
11 | squash:
12 | body: pull_request_body
13 | message_delimiter: ==COMMIT_MSG==
14 | delete_after_merge: true
15 | update:
16 | trigger:
17 | labels: ["update me"]
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.parallel=true
2 | org.gradle.caching = true
3 | org.gradle.jvmargs = --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
4 | palantir.jdk.setup.enabled=true
5 | palantir.native.formatter=true
6 |
--------------------------------------------------------------------------------
/.excavator.yml:
--------------------------------------------------------------------------------
1 | # Excavator auto-updates this file. Please contribute improvements to the central template.
2 |
3 | auto-label:
4 | names:
5 | versions-props/upgrade-all: [ "merge when ready" ]
6 | circleci/manage-circleci: [ "merge when ready" ]
7 | tags:
8 | donotmerge: [ "do not merge" ]
9 | roomba: [ "merge when ready", "🤖 fix nits" ]
10 | automerge: [ "merge when ready", "🤖 fix nits" ]
11 | standards: [ "merge when ready", "🤖 fix nits" ]
12 | autorelease: [ "autorelease" ]
13 |
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Excavator auto-updates this file. Please contribute improvements to the central template:
2 |
3 | only: pulls
4 | staleLabel: stale
5 | pulls:
6 | daysUntilStale: 14
7 | daysUntilClose: 7
8 | exemptLabels: [ long-lived ]
9 | markComment: >
10 | This PR has been automatically marked as stale because it has not been touched in the last 14 days.
11 | If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.
12 | closeComment: false
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # IntelliJ
2 | *.iml
3 | *.ipr
4 | *.iws
5 | .idea/
6 |
7 | # Eclipse
8 | .classpath
9 | .checkstyle
10 | .factorypath
11 | .project
12 | .settings
13 | *.launch
14 |
15 | # Codegen
16 | .generated
17 | .apt_generated
18 | generated_src/
19 | **/src/generated/
20 |
21 | # OS X
22 | .DS_Store
23 |
24 | # Java
25 | *.class
26 |
27 | # Build Systems
28 | .gradle/
29 | bin/
30 | build/
31 | out/
32 | reports/
33 |
34 |
35 | # SublimeText + TextMate + Vim
36 | *.sublime-workspace
37 | *.sublime-project
38 | *.tmproj
39 | *.tmproject
40 | *.sw[op]
41 |
42 | # Gradle JDKs setup
43 | !gradle/*
44 |
--------------------------------------------------------------------------------
/.baseline/copyright/001_apache-2.0.txt:
--------------------------------------------------------------------------------
1 | (c) Copyright ${today.year} Palantir Technologies Inc. All rights reserved.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/versions.props:
--------------------------------------------------------------------------------
1 | com.fasterxml.jackson.*:* = 2.20.1
2 | com.fasterxml.jackson.core:jackson-annotations = 2.20
3 | com.gradleup.shadow:shadow-gradle-plugin = 9.2.2
4 | org.immutables:value = 2.11.7
5 | com.google.guava:guava = 33.5.0-jre
6 |
7 | # Test deps
8 | com.palantir.tracing:tracing = 6.29.0
9 | com.palantir.safe-logging:safe-logging = 3.9.0
10 | com.palantir.tritium:tritium-registry = 0.115.0
11 | commons-io:commons-io = 2.21.0
12 |
13 | # conflict resolution
14 | com.google.code.findbugs:jsr305 = 3.0.2
15 | com.google.errorprone:error_prone_annotations = 2.11.0
16 | org.checkerframework:checker-qual = 3.52.0
17 | org.junit.jupiter:* = 6.0.1
18 | org.junit.platform:* = 6.0.1
19 | org.junit.vintage:* = 6.0.1
20 |
21 | # gradlePluginForTesting
22 | org.unbroken-dome.test-sets:org.unbroken-dome.test-sets.gradle.plugin = 4.1.0
23 | com.palantir.gradle.consistentversions:gradle-consistent-versions = 3.7.0
24 | com.netflix.nebula:nebula-publishing-plugin = 17.2.1
25 |
--------------------------------------------------------------------------------
/.baseline/eclipse/dynamic/dotfile.checkstyle:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.baseline/checkstyle/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # Gradle shadow jar  [](https://opensource.org/licenses/Apache-2.0)
6 |
7 |
8 | This is a Gradle plugin that wraps the existing [`shadow`](https://github.com/GradleUp/shadow) Gradle plugin to
9 | make producing *partially shaded jars* much easier. This means you can shade just one of your dependencies in a library or Gradle plugin to avoid dependency clashes. It is possible to produce fully shaded jars with this plugin, but it is not the aim of this plugin, and perf may be bad for shading a large dependency tree.
10 |
11 | ## Applying the plugin
12 |
13 | To apply this plugin, *build.gradle* should look something like:
14 |
15 | ```diff
16 | buildscript {
17 | repositories {
18 | maven { url 'https://dl.bintray.com/palantir/releases' }
19 | }
20 |
21 | dependencies {
22 | classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:'
23 | + classpath 'com.palantir.gradle.shadow-jar:gradle-shadow-jar:'
24 | }
25 |
26 | apply plugin: 'com.palantir.consistent-versions'
27 | + apply plugin: 'com.palantir.shadow-jar'
28 | }
29 | ```
30 |
31 | *Requires [`gradle-consistent-versions`](https://github.com/palantir/gradle-consistent-versions) and Gradle 8.11+ to work.*
32 |
33 | ## Producing shaded JARs
34 |
35 | Shading is where you copy the class files of another jar into your jar, and then change the package names
36 | of the classes from the original jar. This removes dependencies from your project's publication and can reduce
37 | dependency conflicts at the expense of increased jar size and build time.
38 |
39 | To use, identify which of your dependencies you want shaded and put them in the `shadeTransitively` configuration like so:
40 |
41 | ```gradle
42 | dependencies {
43 | implementation 'some-unshaded:dependency'
44 |
45 | shadeTransitively 'com.google.guava:guava'
46 | }
47 | ```
48 |
49 | The dependency you list and all its dependencies will be shaded *unless* one of these dependencies exists in other
50 | standard java configurations. For example, [`com.google.guava:guava:28.2-jre`](https://mvnrepository.com/artifact/com.google.guava/guava/28.2-jre)
51 | depends on [`'com.google.code.findbugs:jsr305:3.0.2'`](https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305/3.0.2).
52 | If you use the following:
53 |
54 | ```gradle
55 | dependencies {
56 | implementation 'com.google.code.findbugs:jsr305'
57 |
58 | shadeTransitively 'com.google.guava:guava'
59 | }
60 | ```
61 |
62 | will shade `guava` and all its dependencies except for `jsr305` (and its dependencies), which will not be shaded and
63 | appear in the maven POM.
64 |
65 | We explicitly ban logging libraries from shading, as they can cause problems when shaded, and will show up as real
66 | dependencies in your POM, even if they were brought in as transitives through `shadeTransitively`.
67 |
68 | We also ban tracing and metric libraries, as they might rely on static variables (see `com.palantir.tracing.Tracer`
69 | and `com.palantir.tritium.metrics.registry.DefaultTaggedMetricRegistry`).
70 |
--------------------------------------------------------------------------------
/gradle/gradle-jdks-setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # (c) Copyright 2024 Palantir Technologies Inc. All rights reserved.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | ##############################################################################
19 | #
20 | # Gradle jdk set up script for POSIX generated by gradle-jdks.
21 | #
22 | # This script does the following:
23 | # (1) Downloads all the JDK distributions that are present in `gradle/jdks`
24 | # (2) Installs the distributions in a temporary directory
25 | # (3) Calls the java class `GradleJdkInstallationSetup` that will move each distribution to
26 | # `$GRADLE_USER_HOME/${local_path}` based on the local_path=`gradle/jdks/${majorVersion}/${os}/${arch}/local_path`
27 | # and it will set up the certificates based on `gradle/certs` entries for the locally installed distribution
28 | # (4) Sets `org.gradle.java.home` to the JDK distribution that is used by the Gradle Daemon
29 | #
30 | #
31 | # Important for running:
32 | # This script requires all of these POSIX shell features:
33 | # * functions;
34 | # * expansions «$var», «${var}», «${var%suffix}», and «$( cmd )»;
35 | # * compound commands having a testable exit status, especially «case»;
36 | # * various built-in commands including «command» and «set».
37 | #
38 | ##############################################################################
39 |
40 | set -e
41 | # Set pipefail if it works in a subshell, disregard if unsupported
42 | # shellcheck disable=SC3040
43 | if (set -o pipefail 2>/dev/null); then
44 | set -o pipefail
45 | fi
46 |
47 | # Resolve links: $0 may be a link
48 | app_path=$0
49 |
50 | # Need this for daisy-chained symlinks.
51 | while
52 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
53 | [ -h "$app_path" ]
54 | do
55 | ls=$( ls -ld "$app_path" )
56 | link=${ls#*' -> '}
57 | case $link in #(
58 | /*) app_path=$link ;; #(
59 | *) app_path=$APP_HOME$link ;;
60 | esac
61 | done
62 |
63 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
64 | APP_HOME=${APP_HOME%/gradle}
65 | APP_GRADLE_DIR="$APP_HOME"/gradle
66 |
67 | # Loading gradle jdk functions
68 | . "$APP_GRADLE_DIR"/gradle-jdks-functions.sh
69 |
70 | if ! is_arch_os_supported; then
71 | echo "Skipping Gradle JDKs Setup, Unsupported OS/Arch..."
72 | cleanup
73 | return
74 | fi
75 |
76 | install_and_setup_jdks "$APP_GRADLE_DIR"
77 |
78 | gradle_daemon_jdk_version=$(read_value "$APP_GRADLE_DIR"/gradle-daemon-jdk-version)
79 | gradle_daemon_jdk_distribution_local_path=$(read_value "$APP_GRADLE_DIR"/jdks/"$gradle_daemon_jdk_version"/"$OS"/"$ARCH"/local-path)
80 | "$GRADLE_JDKS_HOME"/"$gradle_daemon_jdk_distribution_local_path"/bin/java -cp "$APP_GRADLE_DIR"/gradle-jdks-setup.jar com.palantir.gradle.jdks.setup.GradleJdkInstallationSetup daemonSetup "$APP_HOME" "$GRADLE_JDKS_HOME/$gradle_daemon_jdk_distribution_local_path"
81 |
82 | # [Used by ./gradlew only] Setting the Gradle Daemon Java Home to the JDK distribution
83 | export GRADLE_DAEMON_JDK="$GRADLE_JDKS_HOME/$gradle_daemon_jdk_distribution_local_path"
84 | set -- "-Dorg.gradle.java.home=$GRADLE_DAEMON_JDK" "$@"
85 |
86 | cleanup
87 |
--------------------------------------------------------------------------------
/src/main/java/com/palantir/gradle/shadowjar/JarFilesRelocator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.palantir.gradle.shadowjar;
18 |
19 | import com.github.jengelman.gradle.plugins.shadow.relocation.CacheableRelocator;
20 | import com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator;
21 | import com.google.common.base.Preconditions;
22 | import com.google.common.base.Suppliers;
23 | import com.google.common.collect.ImmutableList;
24 | import java.io.IOException;
25 | import java.io.UncheckedIOException;
26 | import java.util.Collections;
27 | import java.util.Set;
28 | import java.util.function.Supplier;
29 | import java.util.jar.JarFile;
30 | import java.util.regex.Matcher;
31 | import java.util.regex.Pattern;
32 | import java.util.stream.Collectors;
33 | import java.util.stream.Stream;
34 | import java.util.zip.ZipEntry;
35 | import org.codehaus.plexus.util.SelectorUtils;
36 | import org.gradle.api.file.FileCollection;
37 | import org.gradle.api.logging.Logger;
38 | import org.gradle.api.logging.Logging;
39 | import org.gradle.api.tasks.Classpath;
40 |
41 | /**
42 | * Custom relocator that uses {@code Set} based lookups instead of {@link SimpleRelocator}'s include/exclude pattern
43 | * matching.
44 | *
45 | *
We don't use {@link SimpleRelocator}'s include list because it uses {@link SelectorUtils#matchPath} for every
46 | * pattern against every file in the jar, which is {@code O(n*m)} where {@code n = number of files} and
47 | * {@code m = number of patterns}. This causes a massive performance penalty (e.g., 8 minutes vs 13 seconds for tests).
48 | *
49 | *