I’m using `kotlin.copyClassesToJavaOutput = true` ...
# gradle
m
I’m using
kotlin.copyClassesToJavaOutput = true
and it works well in our setup, but it causes tests to run twice when using the gradle test runner
h
Please try setting a
classesDir
for the main and test source sets:
sourceSets.main.classesDir = "..."
This will make Gradle think there's only one classes directory and disregard the separate Kotlin one.
m
ok thanks. I actually have been setting
Copy code
sourceSets.main.kotlin.outputDir = classesDir
        sourceSets.test.kotlin.outputDir = testClassesDir
(which doesn’t work)
and it does work when setting the deprecated properties
Copy code
sourceSets.main.output.classesDir = classesDir
        sourceSets.test.output.classesDir = testClassesDir
is it intentional that it only works with the deprecated ones? as it yields the warning
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
as a sidenote I just managed to get rid of the warnings by using
Copy code
sourceSets.main.output.classesDirs.setFrom(classesDir)
        sourceSets.test.output.classesDirs.setFrom(testClassesDir)
instead