In seems that Kotlin Gradle plugin ignores the specified compilation output directory:
sourceSets {
main {
kotlin {
srcDirs 'source/kotlin'
outputDir = file('work/program')
}
}
}
The compiler output goes to 'build/classes/kotlin/main' directory instead of 'work/program'. But outputDir specified in the same way works as expected in Java Gradle projects.
Is there a way to use custom compiler output directory with Kotlin Gradle plugin? (versions: Kotlin 1.2.31, Gradle 4.6)
Update: I submitted bug report about this: https://youtrack.jetbrains.com/issue/KT-23807
There is workaround, posted by other user in the Kotlin issue tracker:
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
destinationDir = new File(buildDir, "work/program")
}
(add this fragment in your 'build.gradle' file)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With