tuxdna
tuxdna

Reputation: 8487

ScalaIDE 3.0.3 gives error with scala 2.9.x

I am using ScalaIDE version 3.0.3-20140327-1716-Typesafe and I want to use Scala 2.9.x in my project.

I have configured a SBT project which use Scala 2.9.3 and created an Eclipse project :

$ sbt eclipse

After I imported it into Eclipse, I see following error:

The version of scala library found in the build path is incompatible with the one provided by scala IDE: 2.9.3. Expected: 2.10.4. Please replace the scala library with the scala container or a compatible scala library jar.

I then added scala-library 2.9.3 to the dependencies, still I get the same error:

$ cat build.sbt
name := "sample-project"

scalaVersion :="2.9.3"

version :="1.0"

libraryDependencies += "org.scala-lang" % "scala-library" % "2.9.3"

If I add Scala Nature from within Eclipse ( ScalaIDE ) then I get a different error:

More than one scala library found in the build path (/home/tuxdna/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar, /home/tuxdna/software/scala-ide-3.0.3/configuration/org.eclipse.osgi/bundles/290/1/.cp/lib/scala-library.jar).At least one has an incompatible version. Please update the project build path so it contains only compatible scala libraries.

How can I avoid these errors?

EDIT:

Upvotes: 2

Views: 1561

Answers (2)

tuxdna
tuxdna

Reputation: 8487

This is a workaround I found for myself:

I added Scala nature to the project, which added Scala 2.10.x library. However it gave the second error i.e. two versions of scala library.

So I removed the scala-library-2.9.x.jar from project classpath, but I added Scala 2.10.x using Add Scala Nature.

This way I don't see any error in Eclipse. However, to run code that totally depends Scala 2.9.x, I use console

Either Sbt:

$ sbt 'run-main com.package.MainClass arg1 arg2'

Of, if the project is configured using Maven:

$ mvn exec:java -Dexec.mainClass=com.package.MainClass -Dexec.args="arg1 arg2"

Upvotes: 0

Alexey Romanov
Alexey Romanov

Reputation: 170899

Scala IDE is tied to a specific Scala version. In particular

The 3.0.3 release is the second maintenance release of the 3.0 version. It is available for Scala 2.10, on Eclipse 3.8/4.2/4.3 (Juno & Kepler).

For 2.9, you have to install 3.0.0, see http://scala-ide.org/download/current.html.

Upvotes: 2

Related Questions