I am using intellij 14 with scala 2.11.6 installed using home brew and symlink using
ln -s /usr/local/Cellar/scala/2.11.6/libexec/src /usr/local/Cellar/scala/2.1
This worked for me. I'm using Idea 2019.2.2 and Windows 10.
In the folder .idea/libraries/
I had two files: sbt__org_scala_lang_scala_library_2_13_0_jar.xml
and sbt__org_scala_lang_scala_library_2_13_0_jar2.xml
.
I deleted the second file. Then I opend the first one and there were duplicate lines:
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/jline/jline/2.14.6/jline-2.14.6.jar" />
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.0/scala-compiler-2.13.0.jar" />
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.0/scala-compiler-2.13.0.jar" />
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.0/scala-library-2.13.0.jar" />
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.0/scala-library-2.13.0.jar" />
<root url="file://$USER_HOME$/AppData/Local/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.0/scala-reflect-2.13.0.jar" />
So I deleted duplicates and errors disappeared. Hope this will help someone else.
I also ran into that error. The fix I found was to remove the duplicate scala-library in the .iml file generated by intellij.
Basically I located the relevant .iml file by grepping the scala version, and found that two scala-library in that file. I removed the scala 2.11 version, and then it works.
Having similar symptoms, but on a Ubuntu
machine, not using brew
:
I am using /usr/share/sbt/bin/sbt-launch.jar
as launcher. To fix the mentioned problem, I've had to purge the directories 1) project
, 2) target
and 3) .idea
of the relevant Scala projects, doing sbt refresh in IntelliJ (View
- Tool Windows
-> sbt
, hit the Reimport all sbt projects
icon), and rebuild all modules afterwards.
As a last step, when the error occurs further, switch over to Ubuntu shell / terminal, and do a sbt clean compile
in the problematic project folder. Fix the compile issues if some are occuring. If this does not help, change scalaVersion
in build.sbt
e.g. from 2.12.9
to 2.12.8
(the error occurs more often with 2.12.9
), remove scalaOrganization
definition (but keep organization
). Repeat the sbt refresh
of IntelliJ. OMG.
You have JAR files from multiple versions of scala-library.jar
. In order to make the error go away you will have to delete the duplicates. To figure out which version you want to keep, you can view the manifest file inside each JAR:
META-INF/MANIFEST.MF
Inside the manifest file you should see something like this:
Manifest-Version: 1.0
Class-Path:
Implementation-Title: Scala-Library
Implementation-Version: 2.11.4
The error is happening because IntelliJ cannot figure out which version of a given Scala class to use.
This worked for me: In IDEA
Preferences -> Plugins -> Scala -> Update
Restart IDEA