File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,12 @@ method can be used to add extra files.
109
109
``` groovy
110
110
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
111
111
from('extra.jar') {
112
- // Copy the contents of the extra.jar file into META-INF/ in the shadowed JAR.
112
+ // Copy extra.jar file (without unzipping) into META-INF/ in the shadowed JAR.
113
113
into('META-INF')
114
114
}
115
+ from('Foo') {
116
+ // Copy Foo file into Bar/ in the shadowed JAR.
117
+ into('Bar')
118
+ }
115
119
}
116
120
```
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
20
20
import com.github.jengelman.gradle.plugins.shadow.util.Issue
21
21
import com.github.jengelman.gradle.plugins.shadow.util.containsEntries
22
22
import com.github.jengelman.gradle.plugins.shadow.util.doesNotContainEntries
23
+ import com.github.jengelman.gradle.plugins.shadow.util.getContent
23
24
import com.github.jengelman.gradle.plugins.shadow.util.getMainAttr
24
25
import com.github.jengelman.gradle.plugins.shadow.util.getStream
25
26
import com.github.jengelman.gradle.plugins.shadow.util.runProcess
@@ -659,12 +660,16 @@ class JavaPluginTest : BasePluginTest() {
659
660
@Test
660
661
fun canAddExtraFilesIntoShadowJar () {
661
662
writeMainClass()
663
+ path(" Foo" ).writeText(" Foo" )
662
664
projectScriptPath.appendText(
663
665
"""
664
666
$shadowJar {
665
667
from(files('${artifactAJar.toUri().toURL().path} ')) {
666
668
into('META-INF')
667
669
}
670
+ from('Foo') {
671
+ into('Bar')
672
+ }
668
673
}
669
674
""" .trimIndent(),
670
675
)
@@ -675,8 +680,10 @@ class JavaPluginTest : BasePluginTest() {
675
680
containsEntries(
676
681
" my/Main.class" ,
677
682
" META-INF/a-1.0.jar" ,
683
+ " Bar/Foo" ,
678
684
)
679
685
doesNotContainEntries(* entriesInA)
686
+ getContent(" Bar/Foo" ).isEqualTo(" Foo" )
680
687
}
681
688
val unzipped = path(" unzipped" )
682
689
outputShadowJar.use {
You can’t perform that action at this time.
0 commit comments