Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message for when coursier cannot fetch a JVM for Bloop #3146

Open
Gedochao opened this issue Sep 3, 2024 · 0 comments
Open
Labels
Bloop Issues tied with Bloop integration. enhancement New feature or request os:BSD Issues tied with BSD operating systems integration reporting Issues tied with error and warning reporting.

Comments

@Gedochao
Copy link
Contributor

Gedochao commented Sep 3, 2024

Is your feature request related to a problem? Please describe.
On systems for which there is no Java 17+ listing in Coursier's jvm-index, if the JVM isn't provided on Scala CLI startup (i.e. via an environment variable), the error we are printing seemingly coming straight from Coursier) is quite cryptic, and it's not indicating what the user should do in any way. OpenBSD is an example of such an OS.

scala $ env JAVA_HOME=/usr/local/jdk-1.8.0 scala 
Error: java.lang.Exception: Unrecognized OS: openbsd
For more details, please see '/usr/ports/lang/scala/.scala-build/stacktraces/1725217762-8871160887746307735.log'
scala $ cat /usr/ports/lang/scala/.scala-build/stacktraces/1725217762-8871160887746307735.log
java.lang.Exception: Unrecognized OS: openbsd
  coursier.jvm.JvmIndex$.defaultOs(JvmIndex.scala:173)
  scala.build.internal.OsLibc$.jvmIndexOs$lzyINIT1(OsLibc.scala:59)
  scala.build.internal.OsLibc$.jvmIndexOs(OsLibc.scala:58)
  scala.cli.javaLauncher.JavaLauncherCli$.runAndExit(JavaLauncherCli.scala:22)
  scala.cli.ScalaCli$.main0(ScalaCli.scala:251)
  scala.cli.ScalaCli$.main(ScalaCli.scala:117)
  scala.cli.ScalaCli.main(ScalaCli.scala)

Describe the solution you'd like
We need a better error message, optimally explaining to the user what he could do to make Scala CLI work.
The workaround of using --server=false should also be suggested.

Describe alternatives you've considered
We could try to improve the jvm-index system coverage, but that's tricky and there's always some niche OS that we won't be able to cover and its (power) users would still have to set up the JVM themselves.

Additional context
Extracted out of:

@Gedochao Gedochao added enhancement New feature or request os:BSD Issues tied with BSD operating systems integration reporting Issues tied with error and warning reporting. labels Sep 3, 2024
@Gedochao Gedochao added the Bloop Issues tied with Bloop integration. label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bloop Issues tied with Bloop integration. enhancement New feature or request os:BSD Issues tied with BSD operating systems integration reporting Issues tied with error and warning reporting.
Projects
None yet
Development

No branches or pull requests

1 participant