Different version of scala lib in build path and scala-ide - eclipse

I have two versions of scala (2.11.4 and 2.10.4). Currently I work on project based on scala 2.10. I've changed version in project properties but ide still complains about it:
The version of scala library found in the build path (2.10.4.) is different from the one provided by scala IDE (2.11.4.). Make sure you know what you are doing.
I am using
Scala IDE build of Eclipse SDK
Build id: 4.0.0-vfinal-20141216-1226-Typesafe
Project config:
Any idea how fix that?

That complaint is a warning, not an error; all is fine. I suspect the message is mostly left over from when scala-ide used to only support working with a single version of scala in a single install (which was only fixed in 4.0)

Yes, you can use the multiple scala version support, as described in this blog post.
Once correctly configured, as you showed in the image, this is just a warning and therefore safe to ignore.

Related

possibility of scala-virtualized in Eclipse with Scala >=2.11

I followed this guide: http://lamplmscore.epfl.ch/mediawiki/index.php/Eclipse_IDE_with_Scala-virtualized
in order to use the virtualized (-Yvirtualize ) plugin inside the eclipse compiler. This works for a nightly build of Scala 2.10 which is old and lacks features like implicit classes. Does anyone know of a way to work with newer versions of Scala with the virtualize plugin AND eclipse?
Sorry to be bringing bad news:
The Eclipse IDE for Scala-virtualized has not been updated in the last 2 years, so it's not expected to be usable (Source: I maintained the EclipseIDE for scala-virtualized) -- I updated the wiki.
Regarding 2.11, please see Alexey's comment (and answer) below.
Scala-virtualized has been updated to 2.11.2 now. You can definitely use it in IDEA, at least (just make sure the Scala-virtualized scala-{library,reflect,compiler}.jar are above the non-virtualized versions in Dependencies tab under Project Settings -> Modules). I don't know if you can use it in Eclipse, but it might be possible using Scala installations support (see under BYOS (Bring Your Own Scala)).

jvm-1.6 is not a valid choice for -target in eclipse

I imported an android App written in Scala to eclipse but I got this error when I tried to run it:
'jvm-1.6' is not a valid choice for '-target'
Does anyone know how to fix this?
I've also encountered this.
The best answer I've managed to come up with is that the android app is set up for scala 2.10 but your eclipse is using scala 2.9 or lower, as 'jvm-1.6' is only valid for scala 2.10 and above.
If you do have scala 2.10 installed and eclipse is using it, then you should be able to change it in the scala settings:
Go to: Preferences -> Scala -> Compiler
Change 'target' in the 'Standard' tab to 'jvm-1.6'
I haven't verified this as I don't have scala 2.10 installed yet -- I haven't found a .deb file for it yet -- but this answer on Google groups seems to suggest this is the cause.

How to use just one scala library for maven/eclipse/scala

I have configured a project to use scala/maven/Eclipse. Because I need a scala library on the build path and scalatest also uses its own scala library I receive this warning :
More than one scala library found in the build path, all with
compatible versions. This is not an optimal configuration, try to
limit to one scala library in the build path.
I don't think I can remove this warning as I need both libraries - one for Maven, the other for Eclipse. This doesn't seem to be causing any problems so will I just have to accept it? Is there an alternate configuration which uses just one scala library for Maven & Eclipse?
If I remove the scala library from the project I receive the error:
Cannot find Scala library on the classpath. Verify your build path!
For some reason Eclipse requires the scala library to be on the build path even though it is already available as a Maven dependency.
There is nothing to worry about. Eclipse warns you that you have several scala-library.jars on your classpath, but as long as they are the same version, it doesn't matter.
If one of them diverged (for instance, by bumping the Scala version number in your pom file), you'd be in trouble: depending on the classpath order, the IDE will pick up classes from one or the other, and you might get different results when building on the command line.
Coming back to your setup, you could
remove the Scala Library classpath container from your Eclipse projects, leaving just the jar that maven adds.
ignore the warning
Venturing a guess here, are you using the Eclipse Indigo pre-installed with Scala 2.9 and the corresponding Scala plugin? If that's the reason you need to use that library, perhaps consider using Eclipse Juno? That's what I use and it works quite well with both the milestone and the nightly builds

In Eclipse, can I choose the version of Scala for my project?

Currently I'm using Scala IDE, and the version of Scala it's using for my project is 2.9.2. Preferably I'd like to choose 2.8.1, and am not sure how to select a version of the Scala Library.
Is there any way to change the version?
Thanks!
http://scala-ide.org/docs/user/gettingstarted.html
"The list of URLs of the different update sites are available in the download area. The release ones are in the current section. Scala IDE is linked to specific version of Scala, so you have to decide which one you are going to use:
release-29 provides support for projects using Scala 2.9.x (2.9.0-1 or 2.9.1). This is the current version of Scala. Pick this one if you are unsure.
release-28 provides support for projects using Scala 2.8.x (2.8.1 or 2.8.2)."
So you have to install release-28 Scala IDE to compile your Scala project with version 2.8.1 .
The release site can be found here:
http://scala-ide.org/download/current.html

Scala Eclipse IDE - strange behavior

I am giving a try to Scala Eclipse IDE after a very long time. I installed Eclipse and the said Scala plugin only a while ago, but I am unable to get stuff working. In all of the Scala files, I get the errors like following (See the tooltip):
This project uses Gradle for building, and I also have the latest version of Groovy plugin installed. Please help me get this thing working. Thanks.
Edit:
Thank you, everyone. The problem was solved. It appears there was a problem with my Scala plugin installation. A complete reinstall of everything (including Eclipse) helped. Also, this time I did not install the Groovy plugin.
I don't know which version of Eclipse / Scala-IDE you're using, but there are two reasons I know this sometimes happens:
1) You don't have JDT weaving for Scala installed.
The scala-ide uses aspects to weave in code into the JDT compiler. If you don't have this installed, this may cause the Scala files to be seen as Java files.
2) If, somehow, the Java Source File content type includes *.scala. In fact, it should be Scala Source File. If this is the case, you should remove the *.scala from the Java Source File content type.