Skip to content

Support adding excluded dependencies into shadow configuration#2106

Closed
Goooler wants to merge 2 commits into
mainfrom
g/20250714/fix-issue-265
Closed

Support adding excluded dependencies into shadow configuration#2106
Goooler wants to merge 2 commits into
mainfrom
g/20250714/fix-issue-265

Conversation

@Goooler

@Goooler Goooler commented Jul 14, 2026

Copy link
Copy Markdown
Member

Closes #265.


  • CHANGELOG's "Unreleased" section has been updated, if applicable.

@Goooler Goooler force-pushed the g/20250714/fix-issue-265 branch from 2ea0a8b to 3b809df Compare July 15, 2026 03:06
@Goooler Goooler force-pushed the g/20250714/fix-issue-265 branch from 3b809df to 158a241 Compare July 15, 2026 07:47
@Goooler Goooler changed the title Publish dependencies excluded from shadow JAR Support adding excluded dependencies into shadow configuration Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in feature to automatically add dependencies excluded from the ShadowJar dependency filter into the shadow configuration (as non-transitive dependencies), improving publishing/runtime metadata behavior for consumers (closes #265).

Changes:

  • Introduces shadow.addExcludedDependenciesToShadowConfiguration (default false) on ShadowExtension.
  • Implements automatic population of the shadow configuration from ShadowJar’s excluded artifacts.
  • Adds functional tests covering publishing/application/java plugin scenarios and updates publishing docs + changelog + API dump.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt Adds logic to derive excluded artifacts from ShadowJar and add them into shadow as non-transitive dependencies.
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowExtension.kt Adds new extension property with KDoc describing behavior and default.
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowBasePlugin.kt Wires the new property default (convention(false)).
src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt Verifies the new property defaults to false.
src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt Adds functional coverage for excluded deps (including project deps and classifier artifact preservation).
src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt Ensures publishing emits excluded dependency without transitives (via *:* exclusions).
src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt Ensures installShadowDist includes excluded dependency without transitives.
docs/publishing/README.md Documents the new opt-in behavior and how it interacts with custom shadowJar.configurations.
docs/changes/README.md Adds an Unreleased changelog entry for the new option.
api/shadow.api Updates ABI dump for the new ShadowExtension getter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +71
tasks.shadowJar.map { shadowJar ->
val includedFiles = shadowJar.includedDependencies.files
shadowJar.configurations
.get()
.flatMap { it.resolvedConfiguration.resolvedArtifacts }
.filterNot { it.file in includedFiles }
.distinctBy { it.id.componentIdentifier to it.file }
.map { artifact -> createShadowDependency(artifact) }
}
@Goooler Goooler closed this Jul 15, 2026
@Goooler Goooler deleted the g/20250714/fix-issue-265 branch July 15, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add excluded dependencies to the shadow configuration automatically

2 participants