Scala Eclipse IDE - strange behavior - eclipse

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.

Related

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

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.

Problem on error highlight using IntelliJ 10 CE with the scala plug-in

I'm having some strange behavior in the IntelliJ editor when editing scala sources. It continuously report problem of kind "cannot resolve symbol" on various Predef functions like "require" and "->".
It seems to be only an editor problem because I am able to run scala code in Intellij and compile the sources using maven.
Am I the only one having this kind of problem ?
I'm using the Intellij version 10.0.3 CE and scala plugin version 0.4.735.
Thanks.
I would recommend using the latest IntelliJ IDEA EAP together with the latest Scala Plugin. This is known to solve a lot of problems.
Please, check the project configuration guide. It's likely that you forgot to add Scala standard library to the module dependencies.

Groovy + Eclipse

I have a simple question regarding groovy with eclipse. I downloaded the plugin as mentioned and i didnt have problems with installations but i have compiler errors in hello p. the problem in my opinion that eclipse isnot using the groovy compiler. but i have no idea what to do
Is the filename extension .groovy?
Are you sure the project has the Groovy nature? (right-click on the project, and ensure Remove Groovy Nature appears. If Add Groovy nature appears, then the project doesn't have a groovy nature, and therefore the groovy compiler won't work).
Could you also post the file that isn't compiling. There might be something wrong with what you typed.
Make sure you are opening the file in a Groovy editor.
Look for any exceptions in your error log.
Also, just in case, you can try uninstalling and reinstalling the plugin. I'd recommend using the latest milestone version as that one is about to be promoted to 2.1.2 final.
http://dist.springsource.org/milestone/GRECLIPSE/e3.6/
I confirmed that Groovy plugin isnot workingn on mac. I tried it on 2 machines and they are giving the same error. Groovy plugin is working on windows without problems :)
NetBeans is a better option for Groovy+Java development. You can mix Java and Groovy files in a Java project in NetBeans. It also creates a distributable jar for your project. No classpath and jar issues with NetBeans created MET-INF file.

Plugin classpath issues when running from IDE

I have a maven plugin that transforms class bits after compilation. This plugin works precisely as designed when run from the command line. However, the problem arises in Eclipse (3.6.1) when the Maven project is building from a clean state. What happens is that I get an error message in the console informing me that my plugin has failed due to the inability to find a class that is in fact on the classpath.
As I mentioned, this plugin works perfectly well when I build from the command line, so this is a rather annoying problem that seems a bit difficult to track down.
Has anyone else ran into this problem before, and if so, is there a solution that I'm missing?
Thanks.
I can confirm that the maven eclipse plugin sometimes works different than the "console version". You can try to change the "Preferences->Maven->Installations" to your external maven installation (that what you use when running from command line). The eclipse plugin embedded version is a 3.0-SNAPSHOT (in my installation) and maybe not stable in all points.
The issue turned out to be a difference between Maven 2.x and Maven 3.x. The m2eclipse was using a version of Maven 3.x - can't remember which - and I was running a previous version. Apparently, somewhere in the version range, the plugin mojo now requires #requiresDependencyResolution . Thus, when running in m2eclipse, my plugin was not getting any of the dependencies in the project, and thus the class path was completely boned...
word...

Scala IDE error - "projectname" is not a Scala project -

I have installed latest scala ide plugin to eclipse (Version: 3.4.2). It seems installation is ok without any errors.
I am able to create a scala project and add a package, but i couldn't add scala object, at the time it shows "projectname" is not a Scala project error message in add object dialog.
I have googled and found it could be related to JDT Weaving not enabled in eclipse. I have verified, its enabled and running in my environment.
Below the screenshot of the error.
alt text http://a.imageshack.us/img80/3070/scala.png
I just started scala.. Can someone help me to resolve this problem?
I had a similar error two minutes ago. Here's how I fixed it. I'm using Helios and the relevant Scala IDE version.
Right click on the project name --> Configure --> Add scala nature
I must mention that I have the M2Eclipse plugin as well and my project is a Maven project in addition to having a Scala "nature" .. Not that it should matter .. ;-)
The error message means your project is not recognize as a Scala one (as detailed in the scala.tools.eclipse.wizards.AbstractNewElementWizardPage.scala class.
But adding "Scala nature" to your project, as suggested by Alexey Romanov in the comments, might not be enough in this case.
The requirements mentioned in scala-ide.org clearly include:
Java Developer Toolkit 1.6
Eclipse Classic 3.5.2
So could you try with a more recent Eclipse version?
See Requirements and Installation, and then the turorial:
As mentioned, note the 'S' in the Scala project icon.