Shadowjar's docs say to do this:
shadowJar {
configurations = [project.configurations.compileClasspath]
}
This appears to be in Groovy. If I run this in my Kotlin based gradle project, I get the following error:
Type mismatch:
inferred type is
Array<NamedDomainObjectProvider<Configuration>>, but
(Mutable)List<FileCollection!>! was expected
How can I perform this in Kotlin?
CodePudding user response:
The equivalent would be:
tasks {
shadowJar {
configurations = listOf(project.configurations.compileClasspath.get())
}
}
The call to .get()
is required because the return is NamedDomainObjectProvider<Configuration>
. The Shadow plugin does not appear to support the lazy properties Gradle provides.