gradle 6.x release notes tells us that maven-publish
ing of boot-jars doesn't work because the default jar
task is disabled by the spring-boot plugin.
A workaround is to tell Gradle what to upload. If you want to upload the bootJar, then you need to configure the outgoing configurations to do this:
configurations {
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(bootJar)
}
}
unfortunately all my tries to translate this to gradle-kotlin-dsl fail:
configurations {
listOf(apiElements, runtimeElements).forEach {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(bootJar)
}
}
* What went wrong:
Script compilation errors:
it.outgoing.artifacts.removeAll { it.buildDependencies.getDependencies(null).contains(jar) }
^ Out-projected type 'MutableSet<CapturedType(out (org.gradle.api.Task..org.gradle.api.Task?))>' prohibits the use of 'public abstract fun contains(element: E): Boolean defined in kotlin.collections.MutableSet'
it.outgoing.artifacts.removeAll { it.buildDependencies.getDependencies(null).contains(jar) }
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.jar: TaskProvider<Jar> defined in org.gradle.kotlin.dsl
it.outgoing.artifact(bootJar)
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public val TaskContainer.bootJar: TaskProvider<BootJar> defined in org.gradle.kotlin.dsl
any idea on how to do this groovy workaround in Gradle Kotlin DSL?