Open mbovel opened 2 days ago
Thanks for reporting, that should be impossible :thinking: Earlier versions of Scala CLI should just use older bloop versions. @Gedochao any idea how this happens? I think it did happen previously.
Thanks for reporting, that should be impossible 🤔 Earlier versions of Scala CLI should just use older bloop versions. @Gedochao any idea how this happens? I think it did happen previously.
No idea, but I'll check
@mbovel Does it keep happening after running:
scala-cli bloop exit --power
?
Is there anything interesting when:
scala-cli bloop output --power
?
Also, what platform is this happening on? I can't seem to be able to reproduce on my local machine. I've no clue how the old Bloop fork dependency gets messed up with the newest Bloop version. 😕
I cannot reproduce today 🤷
It now works fine, even when switching from 17 to 21 without explicitly killing the server:
➜ ~/scala-snippets-6 coursier java --jvm adoptium:17 --setup
Checking if ~/.profile, ~/.zprofile need(s) updating.
Some shell configuration files were updated. It is recommended to close this terminal once the setup command is done, and open a new one for the changes to be taken into account.
➜ ~/scala-snippets-6 source ~/.zprofile
➜ ~/scala-snippets-6 scala-cli bloop exit --power
Stopped Bloop server.
➜ ~/scala-snippets-6 java -version
openjdk version "17.0.13" 2024-10-15
OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode)
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
hello
➜ ~/scala-snippets-6 coursier java --jvm adoptium:21 --setup
Checking if ~/.profile, ~/.zprofile need(s) updating.
Some shell configuration files were updated. It is recommended to close this terminal once the setup command is done, and open a new one for the changes to be taken into account.
➜ ~/scala-snippets-6 source ~/.zprofile
➜ ~/scala-snippets-6 java -version
openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode)
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
hello
➜ ~/scala-snippets-6 scala-cli bloop output --power
Bloop server PID: 81239
Ignoring SIGINT
Will truncate output file /Users/mbovel/Library/Caches/ScalaCli/bloop/daemon/output every 5 minutes
Unable to load nailgun-version.properties.
NGServer [UNKNOWN] started on local socket /Users/mbovel/Library/Caches/ScalaCli/bloop/daemon/socket.
I am on a MacBook Pro 2.6 GHz 6-Core Intel Core i7.
Ah, got it again!
The output of scala-cli bloop output --power
(but it doesn't seem related):
➜ ~/scala-snippets-6 scala-cli bloop output --power > bloop_output.txt
➜ ~/scala-snippets-6 scala-cli bloop exit --power
Stopped Bloop server.
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
Compiling project (Scala 3.5.1, JVM (21))
[E] Caught java.lang.InterruptedException
Bloop 'bsp' command exited with code 1. Something may be wrong with the current configuration.
Running the clean sub-command to clear the working directory and remove caches might help.
If the error persists, please report the issue as a bug and attach a log with increased verbosity by passing -v -v -v.
^C%
➜ ~/scala-snippets-6 pkill java
➜ ~/scala-snippets-6 scala hello.scala
Downloading compilation server 2.0.0
Error: java.lang.Exception: Error getting Bloop class path
For more details, please see '/Users/mbovel/scala-snippets-6/.scala-build/stacktraces/1732650920-11351170908216290531.log'
➜ ~/scala-snippets-6 scala-cli bloop exit --power
No running Bloop server found.
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
hello
And interleaved failures and successes:
➜ ~/scala-snippets-6 scala hello.scala
Downloading compilation server 2.0.0
Error: java.lang.Exception: Error getting Bloop class path
For more details, please see '/Users/mbovel/scala-snippets-6/.scala-build/stacktraces/1732651242-15625038165421289792.log'
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
hello
➜ ~/scala-snippets-6 scala hello.scala
hello
➜ ~/scala-snippets-6 scala hello.scala
hello
➜ ~/scala-snippets-6 scala hello.scala
hello
➜ ~/scala-snippets-6 scala hello.scala
Downloading compilation server 2.0.0
Error: java.lang.Exception: Error getting Bloop class path
For more details, please see '/Users/mbovel/scala-snippets-6/.scala-build/stacktraces/1732651287-10082150269091005545.log'
➜ ~/scala-snippets-6 scala hello.scala
Starting compilation server
hello
➜ ~/scala-snippets-6 scala hello.scala
hello
➜ ~/scala-snippets-6 scala hello.scala
Downloading compilation server 2.0.0
Error: java.lang.Exception: Error getting Bloop class path
For more details, please see '/Users/mbovel/scala-snippets-6/.scala-build/stacktraces/1732651311-1525226576094307270.log'
It seems that this came from an interaction between compiling from the CLI and from Metals. After Metals compiled my code, I got the error from the CLI.
Maybe Metals passed some outdated options to Bloop?
After removing .scala-build
, .bsp
, .metals
, I cannot reproduce the issue anymore, so this seems to be it.
What version of metals do you have? Maybe Metals is picking up older scala-cli binary and that is somehow breaking (maybe both scala and scala-cli are on path)? Do you have bloopVersion set explicitly in Metals? If you only run via scala-cli there is no direct interaction between metals and Bloop, so Metals is not actually downloading anything.
The weirdest thing is the organization is not cached anywhere as far as I can tell.
Also, could you paste the contents of your .bsp and .scala-build <- any non bloop json files there. Maybe we are indeed caching something there?
Version(s)
Describe the bug After switching to Java 21,
scala
fails to run because it tries to download non-existing2.0.0
version of Bloop from https://repo1.maven.org/maven2/io/github/alexarchambault/bleep/bloop-frontend_2.12/2.0.0/bloop-frontend_2.12-2.0.0.pom.To Reproduce
Expected behaviour No crash, like with Java 17.