Closed tobyweston closed 2 years ago
Thanks for the report. Could you provide reproduction steps so we can reproduce your problem on our computers? We run CI for sbt using JDK 8 and JDK 17 currently, and it used to be tested on JDK 11 for a long time.
it's very odd, so apologies but I can't reproduce on other PCs... but
New Project
from the Welcome to Intellij IDEA
screen (or if a project is open, File
> New Project
)Scala
and sbt
, hit Next
Finish
Project will initialise but immediately fail with the error above. All my Scala projects seem to do this now 😢
Its on a new Mac (which is variable here - I'm fresh install everything). Its Monterey 12.1, MBP 13' 2020 on Apple M1.
Let me know if you have any thoughts, I'm really sorry this sounds flakey but have exhausted my debugging/experimenting (changed various settings above for example). I can't run IDEA itself on Java 8 (the particular versions restricts to 11).
It's similar to https://youtrack.jetbrains.com/issue/SCL-19190 and in fact, I raised it with IntelliJ at https://youtrack.jetbrains.com/issue/SCL-19883
Could you try reproducing the problem without involving IntelliJ and launching sbt using the official sbt runner (available from https://www.scala-sbt.org/download.html) and JDK built for M1 Macs (for example Temurin 11 https://adoptium.net/releases.html?variant=openjdk11&jvmVariant=hotspot)?
I'm having trouble setting up without IDEA in the mix, suggest we close this issue for now and I'll work with IntelliJ in #SCL-19883 and feedback here if I get anywhere. Thanks for all the help (and SBT and awesome contribs to the community)
Update: I'm in idiot.
I was passing windows specific paths to SBT. So, without IntelliJ in the mix, if I run...
sbt -Dsbt.ivy.home=C:/Users/toby/.ivy
(Which I accidentally inherited when sharing IntelliJ settings between Windows and Mac), I get the error,
bash-3.2$ sbt -Dsbt.ivy.home=C:/Users/toby/.ivy
java.lang.IllegalArgumentException: URI scheme is not "file"
at java.base/java.io.File.<init>(File.java:423)
at xsbt.boot.ResolvePaths$.apply(Find.scala:60)
at xsbt.boot.ResolvePaths$.$anonfun$apply$3(Find.scala:54)
at scala.Option.map(Option.scala:242)
at xsbt.boot.IvyOptions.map(LaunchConfiguration.scala:116)
at xsbt.boot.LaunchConfiguration.map(LaunchConfiguration.scala:78)
at xsbt.boot.ResolvePaths$.apply(Find.scala:54)
at xsbt.boot.Find.apply(Find.scala:45)
at xsbt.boot.Find$.apply(Find.scala:13)
at xsbt.boot.Launch$.parseConfiguration(Launch.scala:110)
at xsbt.boot.Launch$.parseAndInitializeConfig(Launch.scala:104)
at xsbt.boot.Launch$.apply(Launch.scala:33)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.IllegalArgumentException: URI scheme is not "file"
So I guess the error message was throwing me (URI scheme is not file when passing in invalid 'File' paths).
🤦
Does this line have a problem with newer versions of Java?
https://github.com/sbt/launcher/blob/605b67814f4f1a2ed6ddd46213ffec8e8e58ec2e/launcher-implementation/src/main/scala/xsbt/boot/Find.scala#L60
I get the following against
Massive guess from me. I'm running from within IDEA 2021.3.1 (which doesn't let me start the IDE in anything less than JDK 11). I'm speculating that something has changed in Java's
File
to require a scheme... the line above does explicitly set it tonull
...https://github.com/sbt/launcher/blob/605b67814f4f1a2ed6ddd46213ffec8e8e58ec2e/launcher-implementation/src/main/scala/xsbt/boot/Find.scala#L59