File tree Expand file tree Collapse file tree 2 files changed +35
-13
lines changed Expand file tree Collapse file tree 2 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,6 @@ method can be used to add extra files.
159
159
160
160
```kotlin
161
161
tasks.shadowJar {
162
- from("extra.jar") {
163
- // Copy extra.jar file (without unzipping) into META-INF/ in the shadowed JAR.
164
- into("META-INF")
165
- }
166
162
from("Foo") {
167
163
// Copy Foo file into Bar/ in the shadowed JAR.
168
164
into("Bar")
@@ -174,10 +170,6 @@ method can be used to add extra files.
174
170
175
171
```groovy
176
172
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
177
- from('extra.jar') {
178
- // Copy extra.jar file (without unzipping) into META-INF/ in the shadowed JAR.
179
- into('META-INF')
180
- }
181
173
from('Foo') {
182
174
// Copy Foo file into Bar/ in the shadowed JAR.
183
175
into('Bar')
Original file line number Diff line number Diff line change @@ -31,11 +31,41 @@ have the intended effect, as `configurations.compile` will try to delegate to th
31
31
32
32
## Embedding Jar Files Inside Your Shadow Jar
33
33
34
- Because of the way that Gradle handles dependency configuration, from a plugin perspective, shadow is unable to
35
- distinguish between a jar file configured as a dependency and a jar file included in the resource folder. This means
36
- that any jar found in a resource directory will be merged into the shadow jar the same as any other dependency. If
37
- your intention is to embed the jar inside, you must rename the jar as to not end with ` .jar ` before the shadow task
38
- begins.
34
+ The ` shadowJar ` task is a subclass of the ` Jar ` task, which means that the
35
+ [ from] ( https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:from(java.lang.Object,%20groovy.lang.Closure) )
36
+ method can be used to add extra files.
37
+
38
+ === "Kotlin"
39
+
40
+ ```kotlin
41
+ dependencies {
42
+ // Merge foo.jar (with unzipping) into the shadowed JAR.
43
+ implementation(files("foo.jar"))
44
+ }
45
+ tasks.shadowJar {
46
+ from("bar.jar") {
47
+ // Copy bar.jar file (without unzipping) into META-INF/ in the shadowed JAR.
48
+ into("META-INF")
49
+ }
50
+ }
51
+ ```
52
+
53
+ === "Groovy"
54
+
55
+ ```groovy
56
+ dependencies {
57
+ // Merge foo.jar (with unzipping) into the shadowed JAR.
58
+ implementation files('foo.jar')
59
+ }
60
+ tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
61
+ from('bar.jar') {
62
+ // Copy bar.jar file (without unzipping) into META-INF/ in the shadowed JAR.
63
+ into('META-INF')
64
+ }
65
+ }
66
+ ```
67
+
68
+ See also [ Adding Extra Files] ( ../README.md#adding-extra-files )
39
69
40
70
## Filtering Dependencies
41
71
You can’t perform that action at this time.
0 commit comments