triplequote / intellij-scala

Scala plugin for IntelliJ IDEA
http://blog.jetbrains.com/scala/
Apache License 2.0
0 stars 2 forks source link

Cannot download Hydra on sbt imported project with scalaHome set #37

Open dotta opened 6 years ago

dotta commented 6 years ago

Here is the build.sbt file to use to reproduce the issue:

name := "bug"

scalaVersion := "2.11.8"

scalaHome := Some(file("/opt/scala-2.11.8/")) // <-- modify this to point to your scala home

Import the project into idea using the sbt build. Then, enable Hydra on the project and hit the Download button to fetch the Hydra artifacts. The following error is prompted:

Could not determine Scala version in this project

Checking the idea.log provide the trail to understand the issue:

2017-12-22 15:44:21,812 [4923936]   INFO - s.plugins.hydra.HydraVersions$ - Could not retrieve Scala version in module 'bug' with compiler classpath: List(/opt/scala-2.11.8/lib/jline-2.12.1.jar, /opt/scala-2.11.8/lib/scala-compiler.jar, /opt/scala-2.11.8/lib/scala-continuations-library_2.11-1.0.2.jar, /opt/scala-2.11.8/lib/scala-continuations-plugin_2.11.8-1.0.2.jar, /opt/scala-2.11.8/lib/scala-library.jar, /opt/scala-2.11.8/lib/scala-parser-combinators_2.11-1.0.4.jar, /opt/scala-2.11.8/lib/scala-reflect.jar, /opt/scala-2.11.8/lib/scala-swing_2.11-1.0.2.jar, /opt/scala-2.11.8/lib/scala-xml_2.11-1.0.4.jar, /opt/scala-2.11.8/lib/scalap-2.11.8.jar)

The issue is the regex we use to determine the scala version (see HydraVersions).

One possible fix is to look inside the scala-compiler.jar and read the version from the compiler.properties file if there is no version appended to the scala-compiler jar.