I am migrating from goovy to Kotlin script and from 4.10.2 to 6.0.1 (and IntelliJ 2018.3 to 2019.2).
For my project I put all dependent jar files in the folder with my project jar and add their names to the Class-Path attribute in the manifest. My working 4.10.2 groovy code was:
task copyToLibs( type: Copy ) {
into "$buildDir/libs"
from configurations.compile
}
jar {
dependsOn copyToLibs
manifest {
attributes(
"Class-Path": configurations.compile.collect { it.name }.join(' ')
)
}
}
Converting to Kotlin I have:
tasks.register<Copy>("copyToLibs") {
from(configurations.compileClasspath)
into("$buildDir/libs")
}
tasks.named<Jar>("jar") {
dependsOn("copyToLibs")
manifest {
attributes["Main-Class"] = "org.egility.flint.FlintMainKt"
attributes["Class-Path"] = configurations.compileClasspath.joinToString(separator = " ") { it.name }
}
}
This works fine for 4.10.2 but crashes out in 6.0.1 because of the “configurations.compileClasspath.joinToString” statement.
If I omit the statement everything else works and my files get copied correctly, but I need the manifest populated as well.
Can anyone suggest how I should be doing this. It has taken me a week so far to get my development tools up to date and this is the final problem and I would really like to get back to work.