- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Scala Eclipse plugin problems
Mon, 2011-01-31, 00:01
I'm having several problems with Eclipse + Scala.
The goal: To get scala to work in our current environment so we can
write unit tests with Scala against Java projects. If this goes well,
we might start to use some Scala in production code.
The problem: This just isn't working in our environment -- multi-
module maven projects, some webapps, with maven +m2eclipse + eclipse.
Adding Scala leads to several problems including eclipse crashes and
significantly more memory consumed.
* Maven 3.0.1 in a ~20 module project. Some modules are webapps
(type 'war') most are regular java projects.
* Scala added to test scope for one of the modules, works by command
* Eclipse Helios (3.6) latest update with WTP (for webapps)
** m2Eclipse plugin
** m2Eclipse WTP integration
** subversive SVN plugin
** Scala Helios plugin (http://download.scala-ide.org/nightly-update-
** Scala m2Eclipse integration (http://www.assembla.com/wiki/show/
After all the components are installed, I add the Scala Nature to the
project. I then have several issues. I have tried the "Maven >
Update Project Configuration" option which often helps fix the WTP
integration's glitches, but that has no effect on the Scala issues.
Here are the issues:
A large number of my Java classes suddeny get "red x's" as a "Scala
Problem" is highlighted on the source. These problems are of three
* An import in a Java class imports an inner class from another
package: "InnerClassName is not a member of
* A static import has similar issues at times, but with the method
being imported: "createMock is not a member of
* Completely valid Java generics get an error: "Illegal cyclic
reference involving type V" -- for example with a Java class declared
as public class OrderedMultiMap>
If there are any things I can do to prevent the scala plugin from
marking errors in my perfectly valid Java files, that would be
Why does Scala process these java source files, isn't that the Java
compiler's job? Note, this is a Java 1.6 project, I don't know if
that has anything to do with it. Second, it appears to be applying
Scala rules to the imports and type declaration in Java classes. Is
it reading the class files and applying Scala rules to that? The
above three things wouldn't be in a class file generated by Scala, as
far as I can tell.
Next, is a potential killer: Every time I change and save a *.scala
file, it kicks off a "Building Workspace" task, that takes between 15
seconds and 3 minutes on this collection of projects. Note, this is a
big set of related projects with a few thousand java classes across
them. It is as if there is no incremental compile or that is broken
Many times, changing a scala class ends up causing an _infinite loop_
of compiling, that never completes. "Building workspace" runs to
100%, then starts over again. Sometimes, this can be stopped if I
force clean all projects in eclipse (which takes a few minutes ...).
But about half the time I have to restart eclipse to stop it.
These are killers because any gains from a more productive language
are lost if the dev tools incur an extra hour or two a day of waiting
and stopping/starting the dev environment.
The number of situations that cause a full re-build with just Java in
eclipse in the same setup is very small.
Next, running JUnit tests can't be done on individual files by right-
clicking the file and doing "run as >> JUnit test". That is probably
the JUnit plugin's fault, but if there was a way to get that to work
it would be very helpful. It works fine for most Java classes, but
not at all for Scala. I can't even highlight and right click a
function tagged with @Test in the class and run it -- another thing
that works easily in Java.
The last set of issues are stability related. Memory consumption in
eclipse is up about 100MB and others who have tried out this have
reported Eclipse crashes -- one quote "I hadn't had Eclipse crash in
weeks, and after installing the Scala plugin today it crashed 3
times". I have not seen a crash, but have seen the extra memory
consumed. There is no smoking gun here or direct line of evidence,
but its not helping mind-share around here.
Before anyone asks: No, Eclipse 3.5 is not an option, it does not
function with Maven + WTP projects.
Does anyone else have similar issues or means to mitigate/avoid them?
If I can't work around most of the above, Scala looks like its not
something we can integrate into current Java projects with the current
state of Eclipse tooling.