Another example of weird behavior of damned gradle

Can anybody please explain another weird glitch of damned gradle?

I have kotlin MPP project with java sources and java test sources. While trying to run java test with some Chinese Unicode characters in its sources I started getting something like:
character is not compatible with WindowsCp1251'

(Though chinese charaters were properly show in Idea and Idea showed encoding of that source as Utf-8)

Kotlin source encoding is always UTF-8, but how to set java source encoding for Kotlin MPP plugin? I started experimenting trying to set something like:

   jvm().compilations.configureEach {
        compileJava.options.encoding = "UTF-8"
        compileTestJava.options.encoding = "UTF-8"
    }

And got:
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'compileJava' for compilation 'main' (target jvm (jvm)) of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation.

Well, I reverted that block at all, tried to run test again and magically initial error is gone.

But for God’s sake why!?

I hate damned gradle :rage:, when stupid errors mystically appear and even more mystically disappear!

I can understand why it happened (encoding for java sources was not set in Kotlin MPP) but I cannot understand why it stopped! Can anybody explain please?

Did something half-initialized inside a gradle daemon, which then crashed but that initialization got stuck and I so the next test run passed?

1 Like