0

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?

DWR
  • 888
  • 1
  • 8
  • 15

1 Answers1

1

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.

Cisco
  • 20,972
  • 5
  • 38
  • 60