Slackbot
04/13/2023, 1:50 PMVampire
04/13/2023, 1:52 PMSebastian Schuberth
04/13/2023, 1:54 PMVampire
04/13/2023, 1:59 PMisFile check. Maybe it would work better with an artifact transform or maybe when using the shadow plugin.Sebastian Schuberth
04/13/2023, 2:35 PM_configurations_._runtimeClasspath_.get().filter would be evaluated lazily, at execution time, when all elements of the runtimeClasspath are actually present. Is that not the case?Niels Doucet
04/13/2023, 2:47 PMdoFirst or doLast block, otherwise it's all executed at configuration timeAdam
04/13/2023, 2:51 PM.get(), try using .map {} so the Provider isn’t evaluated until necessary, and use the artifacts API
val classpath = configurations.runtimeClasspath
.map { runtimeClasspath ->
runtimeClasspath
.incoming
.artifacts
.artifactFiles
.filter {
// Only bundle JARs that are not specific to the Gradle version.
it.isFile && it.extension == "jar" && !("gradle" in it.path && gradle.gradleVersion in it.path)
}.map {
zipTree(it)
}
}Adam
04/13/2023, 2:54 PMwith(tasks.jar.get())Sebastian Schuberth
04/13/2023, 2:55 PMAdam
04/13/2023, 3:01 PMVampire
04/13/2023, 3:12 PMshadow does not cover all edge cases that make fat jars a sin and bad-practice.
When I ever start a blog, the first entry will about "the good, the bad, and the ugly, when it comes to fat jars" 😄Sebastian Schuberth
04/13/2023, 3:55 PMruntimeClasspath.get() in {} inside from() is they key...