Skip to content

Commit 1395087

Browse files
CopilotGoooler
andauthored
Document excluding non-JAR transitive dependencies (#1986)
* Initial plan * docs: add exclude approach for non-JAR transitive dependencies Co-authored-by: Goooler <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Goooler <[email protected]>
1 parent e18c962 commit 1395087

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

docs/configuration/dependencies/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,37 @@ configuration.
166166
}
167167
```
168168

169+
### Excluding Non-JAR Transitive Dependencies
170+
171+
If the non-JAR file is a transitive dependency (e.g., a POM-only metapackage) that you don't actually need
172+
in your shadowed JAR, you can exclude it using the `dependencies` block instead of embedding it.
173+
174+
=== "Kotlin"
175+
176+
```kotlin
177+
tasks.shadowJar {
178+
dependencies {
179+
exclude(
180+
// Exclude the transitive dependency on js-community, which can't be unzipped by the task.
181+
dependency("org.graalvm.js:js-community:.*"),
182+
)
183+
}
184+
}
185+
```
186+
187+
=== "Groovy"
188+
189+
```groovy
190+
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
191+
dependencies {
192+
exclude(
193+
// Exclude the transitive dependency on js-community, which can't be unzipped by the task.
194+
dependency('org.graalvm.js:js-community:.*'),
195+
)
196+
}
197+
}
198+
```
199+
169200
## Filtering Dependencies
170201

171202
Individual dependencies can be filtered from the final JAR by using the `dependencies` block of a

0 commit comments

Comments
 (0)