Cross-compiled with an incompatible version - eclipse

I am using eclipse with m2eclipse-scala plugin. Currently, I get the following error message:
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
It looks like the versions of extracted Scala and Scala IDE match. I just wanted to make sure that this is a "false-negative" as described here and can be safely turned off.

As #The Archetypal Paul suggested, it was because I was using wrong Scala library.
If you are using Scala 2.11 (check at About Scala IDE -> installation details), you can downgrade by following instruction here. It's a lot easier than uninstalling and re-installing Scala IDE as other Stackoverflow posts recommend.

I also faced the same issue->
I am trying to use casbah jar in scala to integrate with mongodb.
After analyzing the problem i found that ->
i am trying to use casbah 2.9.1 version and my scala version is 2.11.8
Root-Cause of such error is : your jar is compiled in 2.9.0 version and you are using scala 2.11.8 version
So, to resolve that i use the jar that is compiled into 2.11 scala version-
<groupId>org.mongodb</groupId>
<artifactId>casbah-core_2.11</artifactId>
<version>3.1.1</version>

I was facing similar issue in Eclipse IDE where I had built a Spark scala project in Maven. The scala version was set to 2.11.
Later, I upgraded Scala-Ide plugin in Eclipse after which my project marked below errors,
exampleA_2.10-2.0.1.jar of module build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page
Right click project folder > scala > set scala version. Here my scala version was displayed as 2.10. I selected 2.11 and removed all the error messages.

Related

Downgrading Scala 2.12.3 to Scala 2.10 in Eclipse Scala IDE

I currently have Scala 2.12.3 installed and wish to switch it to 2.10. How would I go about doing this in Eclipse? I could not find any guides on it.
Its in eclipse's settings -> Scala Compiler.
You can try this link,
http://scala-ide.org/blog/scala-installations.html
You can change the scala version used for any project by
right click on project->scala->set the scala installation
you will get list of scala versions supported

how to use a different version of scala library with scala ide 3.0.2?

I've got the newest Scala IDE (3.0.2) and I want to compile my stuff with Scala 2.9.3. I've added that version of Scala as a Maven dependency and removed the default 2.10.0 that the IDE bundles with the new project (not my system Scala version, by the way!). The IDE then tells me Scala is not on the build path, even when I add in the jars to the build path. When I try to add a "Scala Library" through that dialogue, it doesn't give me any options and adds 2.10.0. I've gone through the project settings, and would have expected to see a "Scala version" option, but there isn't (only a "Java version" option.)
My question is this:
How do I add a different version of Scala as the Scala library in Scala IDE 3.0.2 ?
Thanks!
I asked a similar question a while back. Short answer is, you can't.
My post:
Scala-IDE 3.0: 2.9.2 -> 2.10.0

Sbt plugin binary incompatibility

I am using the sbtantlr plugin and adapting it to use antlr v3.5. It used to work fine with scala 2.9.2.
Today I upgraded my scala to 2.10.0.
And I compiled the plugin in 2.10.0 and put the plugin 'sbtantlr.jar' in the 'lib' directory of my main scala project.
SBT stopped working with this error message:
Binary incompatibility in plugins detected.
I revert the compiler version to 2.9.2 and it works fine.
Is it because SBT (the official binary release) was built with 2.9? Where can I find the information?
Yes, sbt 0.12.x are built with 2.9x and all plugins need to match the binary Scala version.
To add more information to what Yann said, Scala only guarantees compatibility between minor versions. That is, code compiled with any 2.8.x version is compatible with code compiled with any other 2.8.x version, but no code compiled with 2.8.x is compatible with code compiled by a 2.9.x version.
Now, SBT is a Scala application, and both the plugins and build configuration are libraries to it. SBT 0.12.x was compiled with Scala 2.9.x, so all plugins and project build configuration must also be compiled with Scala 2.9.x.
The project itself can be compiled with any version, as SBT does not need to interact with it.

.jar files cross-compiled with an incompatible version of Scala (2.10)

I am building my first Scala/Play application and after I create and import an eclipse project from the Play shell, I get 17 errors.
akka-actor_2.10.jar is cross compiled with an incompatible version of Scala (2.10)
akka-slf4j_2.10.jar is cross compiled with an incompatible version of Scala (2.10)
anorm_2.10.jar ...
play_2.10.jar ...
play_iterates_2.10.jar ...
The list goes on to include the Scala jars, scalaz jars, etc...
I am using:
Eclipse 4.2.2
Scala ide 3.0.0.nightly-2_09
Scala 2.10
Play 2.1
Has someone experienced the same thing?
Is it possible you are using Scala IDE built for for Scala 2.9.x ?
Make sure you use the one for 2.10.x:
http://download.scala-ide.org/sdk/e38/scala210/dev/site/

Running scalatest and Maven with two scala libraries - one for Maven, the other for Scala Eclipse plugin

The scala Eclipse plugin requires scala 2.10.0 to run :
To run the 'test' goal on Maven I require the dependency :
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>2.0.M5</version>
</dependency>
As part of this dependency 'scala-library-2.9.0-1.jar' is also added to build path :
This causes an error to be displayed on problems tab in Eclipse :
More than one scala library found in the build path. At least one has
an incompatible version. Please update the project build path so it
contains only compatible scala libraries.
How can I fix this error ? I need both scala libraries, one is for the scala eclipse plugin and the other for the scalatest maven plugin. I don't want to just delete the error from the problems tab.
The scala Eclipse plugin requires scala 2.10.0 to run :
It has versions for both 2.10 and 2.9, install the one for 2.9.2 (and use ScalaTest for version 2.9.2 as well). Or use a version of ScalaTest for 2.10, but it seems you'll need to build and install it locally, there isn't one for 2.10.0-RC2 listed at http://mvnrepository.com/artifact/org.scalatest.