Skip to content

Commit 65513d9

Browse files
committed
build: simplify dependencies move
1 parent 44d0878 commit 65513d9

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

vul/vul-webapp-deserialize/build.gradle.kts

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,43 @@ java {
1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
}
1212

13-
configurations {
14-
create("cb110")
15-
create("cb194")
16-
create("cb183")
17-
create("cb170")
18-
create("cb161")
19-
create("cc321")
20-
create("cc40")
21-
}
13+
val dependencyCoordinates = listOf(
14+
"commons-beanutils:commons-beanutils:1.10.0",
15+
"commons-beanutils:commons-beanutils:1.9.4",
16+
"commons-beanutils:commons-beanutils:1.8.3",
17+
"commons-beanutils:commons-beanutils:1.7.0",
18+
"commons-beanutils:commons-beanutils:1.6.1",
19+
"commons-collections:commons-collections:3.2.1",
20+
"org.apache.commons:commons-collections4:4.0"
21+
)
22+
23+
val filesToCopy = objects.fileCollection().from(
24+
dependencyCoordinates.map { coordinate ->
25+
configurations.detachedConfiguration(dependencies.create(coordinate)).apply {}
26+
}
27+
)
2228

2329
dependencies {
24-
"cb110"("commons-beanutils:commons-beanutils:1.10.0")
25-
"cb194"("commons-beanutils:commons-beanutils:1.9.4")
26-
"cb183"("commons-beanutils:commons-beanutils:1.8.3")
27-
"cb170"("commons-beanutils:commons-beanutils:1.7.0")
28-
"cb161"("commons-beanutils:commons-beanutils:1.6.1")
29-
"cc321"("commons-collections:commons-collections:3.2.1")
30-
"cc40"("org.apache.commons:commons-collections4:4.0")
31-
3230
implementation("com.caucho:hessian:4.0.66")
3331
providedCompile("javax.servlet:javax.servlet-api:3.1.0")
3432
testImplementation(libs.junit.jupiter)
3533
testRuntimeOnly(libs.junit.platform.launcher)
3634
}
3735

36+
val depDir = file("src/main/webapp/WEB-INF/dep")
37+
3838
tasks.war {
3939
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
40-
4140
doFirst {
42-
delete("src/main/webapp/WEB-INF/dep")
4341
copy {
44-
from(
45-
configurations["cb110"],
46-
configurations["cb194"],
47-
configurations["cb183"],
48-
configurations["cb170"],
49-
configurations["cb161"],
50-
configurations["cc321"],
51-
configurations["cc40"]
52-
)
53-
into("src/main/webapp/WEB-INF/dep")
42+
from(filesToCopy)
43+
into(depDir)
5444
}
5545
}
5646
}
5747

5848
tasks.clean {
59-
delete("src/main/webapp/WEB-INF/dep")
49+
delete(depDir)
6050
}
6151

6252
tasks.test {

0 commit comments

Comments
 (0)