intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
False positive `kotlin.stdlib.default.dependency` warning
What happened?
My build gets this warning:
The dependency on the Kotlin Standard Library (stdlib) is automatically added when using the Gradle Kotlin plugin and may conflict with the version provided with the IntelliJ Platform, see: https://jb.gg/intellij-platform-kotlin-stdlib
This is a false positive, as my project does have this line in its gradle.properties file:
kotlin.stdlib.default.dependency=false
This is a gradle subproject, not the root project. I have tested and confirmed that setting kotlin.stdlib.default.dependency=false in a subproject gradle.properties file has the intended effect. However, this code from the plugin is causing a bug:
kotlinStdlibDefaultDependency.convention(
project.providers
.gradleProperty("kotlin.stdlib.default.dependency")
.map { it.toBoolean() }
)
This property above should return a value of "false", but instead it returns "true". And the reason why is https://github.com/gradle/gradle/issues/24491 and https://github.com/gradle/gradle/issues/23572.
Relevant log output or stack trace
No response
Steps to reproduce
- Create an IntelliJ plugin module as a subproject
- Give it a
gradle.propertiesfile withkotlin.stdlib.default.dependency=false. Make sure this is in the subproject folder. - Expect no warning, but observe warning.
Gradle IntelliJ Plugin version
2.1.0
Gradle version
8.10.2
Operating System
macOS
Link to build, i.e. failing GitHub Action job
No response
Thanks for filing this, @mgroth0. I ran into this too, and finding this issue helped me break out of fruitless troubleshooting loops trying to clear this warning, one of which was:
I thought I had finally fixed this, when all I had actually done to get rid of the warning was convolutedly disable Kotlin entirely in my plugin subproject, which very quietly broke my plugin—it took me a while to notice ./gradlew check was only green across the board because my plugin tests were simply no longer being compiled and loaded.
Workaround: Setting kotlin.stdlib.default.dependency in the root project's gradle.properties clears the warning (since the root value is the one that is always used, as described in https://github.com/gradle/gradle/issues/23572)
This workaround works for me since it's fine to apply this everywhere in my particular project, but this was all very confusing and time-consuming. @hsz perhaps like a note about this in the docs the warning links to could be really helpful while we wait for the underlying Gradle issue to be solved?