You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
plugins {
`java-library`
}
// compileJava is a generated accessor// However, Gradle fails to resolve it if .gradle.kts is written with CRLF end-of-lines :(
tasks.compileJava {
}
gradlew.bat build:
\src\main\kotlin\my-plugin.gradle.kts: (5, 7): Unresolved reference: compileJava
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details
I've been seeing weird errors with precompiled script plugins on one (Windows) machine since Gradle 6.1. This seems to be what was causing it. Doesn't happen with 6.0.1. Glad to finally understand what was happening!
Expected Behavior
The precompiled script plugin should compile on all major platforms no matter which ends of lines the file has.
Current Behavior
If
my-plugin.gradle.kts
is saved with CRLF ends-of-lines, the plugin can't be compiled on Windows.This sounds super strange, but I can reproduce it reliably.
The workaround is to ensure
.gradle.kts
is saved with LF, so I addsrc/main/kotlin/**/*.gradle.kts text eol=lf
to my.gitignore
.Context
I want to split build logic to a precompiled plugin, however, it leads to an extremely hard to understand failure :(
Steps to Reproduce
Note: it requires Windows. I can't reproduce the failure in my macOS.
build.gradle.kts
:src\main\kotlin\my-plugin.gradle.kts
:gradlew.bat build
:Your Environment
Gradle 6.1.1
Sample failure in GitHub Actions (note that both Linux and macOS builds work there, while Windows fails to build
buildSrc
): https://github.com/weisJ/darklaf/runs/448020434?check_suite_focus=true#step:4:26The text was updated successfully, but these errors were encountered: