Open edoardocomar opened 7 months ago
I assume you have the -Xlint:path
or -Xlint:all
option set?
If this works in Gradle then I can only guess that Gradle is filtering out empty directories, which seems to cheat the whole point of adding that warning. I.e. why aren't you getting the same error on gradlew testclasses
?
As a workaround for now you could change your Gradle project(s) to blank out resource directories that don't exist...
test {
resources {
srcDirs = []
}
}
@Arthurm1 The issue is not just with resource directories. I had only included a small snippet of the log previously, please find here attached a full metals log after opening vscode on a clean kafka trunk git clone and loading a core scala source file.
Please note that I had also installed the java extension for vscode and I found that I need to disable them for the workspace, in order for them not to take over when a Java file is open.
@edoardocomar Ah - it looks like there is also a Bloop issue in that it creates empty directories classes-empty-ProjectName
. I have no idea why it does this.
A workaround for that would be to disable the xlint:path
by changing the build.gradle
and re-exporting.
Add line to Gradle build like this...
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:all"
options.compilerArgs << "-Xlint:-path" // ADD THIS LINE
Thanks @Arthurm1 that does the trick (I also disabled the -Werror
option)
although the result is that the build proceeds where it never arrived before and encounters submodules (jmh-benchmarks
) where it hangs. But that is an altogether different problem ... I will have to disable those or open another issue
Using VSCode with the Scala(Metals) extension on the codebase of Apache Kafka (mixed Java/Scala codebase built with Gradle). Metals doctor shows lots of compilation status errors due to errors like this (from the metals log):
If the directories are created manually, then the status goes green. As there are many such errors, it takes a long time to manually 'fix' the project
Note : I created an issue for Metals and it was reviewed as a bloop problem, so I am trying to get it fixed here https://github.com/scalameta/metals/issues/6249