Scala IDE support

Today we wanted to test the scala java interoperabilty in different IDEs. We used the Scala plugin for Eclipse, Netbeans and IntelliJ. The intellij plugin worked out of the box. We managed to get the eclipse plugin working after some trouble as well. Although the netbeans plugin seems promising the interoperability between java and scala projects did not work.

The eclipse plugin has pretty basic support for code completion, syntax highlihting, and some wizards to create projects, scala classes, objects and traits.
We started out with one java project and one scala project. Testing with the latest release, it was a bit tricky to resolve our imported java classes at build and runtiime and vice versa:

To use a Scala class in your Java project:

  • add the scala project to the build path of your java project (project properties -> Java Build Path -> Projects -> Add…)
  • add the scala nature to your java project (rightclick your java project -> Scala -> add Scala nature)

To use a Java class in your Scala project:

  • import of java.* works fine (for example using java.util.Date in scala, like in the Scala Tutorial for Java programmers)
  • add the java project to the build path of your scala project

With the current eclipse plugin it is not possible to use scala objects in your java classes. This seems to be a known issue.

It’s even possible to create scala and java classes in the same project if your project has both scala and java nature. But the mixed project support in the plugin is still quite buggy: adding a java class to your scala project sometimes make eclipse think that your scala class is a java class. Closing and reopening your project is a way to get around this.

Overall working with the scala eclipse plugin is quite frustating, as it is still very buggy. Actually the first impression was that interoperability does not work at all in the plugin.

The IntelliJ Scala plugin 0.2.22340 had much better Scala support with all the above and then refactoring support (rename, move, introduce variable) and open declaration navigation. IntelliJ also supported Java and Scala interoperability even within the same module.

This Post Has 6 Comments

  1. Miles Sabin

    It’s hard to tell what to make of your review given that you don’t give a version number for the Eclipse plugin or mention what platform you’re working on. The current release ( supports seamlessly mixed Scala and Java projects with very few non-cosmetic issues.

    If you work with a nightly build (rather fairer seeing as there isn’t a release of the IntelliJ plugin yet) you’ll find that the issues you mentioned are fixed (Scala objects are visible from Java and Scala compilation units never appear and Java).

    Where there are issues, it would be vastly more productive to take them to the Scala mailing lists or open tickets for them in the Scala Trac. Vague comments like “Actually the first impression was that interoperability does not work at all in the plugin” made on personal blogs are no help to anyone, yourself included.

  2. Joakim Back

    Your criticism is indeed valid and I appreciate your comment!
    Needless to say, we of course appreciate the work being put in making the Eclipse IDE compatible with Scala.

    As a participant at the Scala IDE support trial-and-error session, my impression of the purpose of this post was a quick overview of the Scala support.

    It appears however that we might have been too hasty to sum up our impression from just a few hours of tinkering. You can be certain though that we’ll continue using it, and posting follow-ups on our exploration.

    It is a fair request that we take an active part in the mailing-list and issue-tracker while doing so.

  3. Jon Bettinger

    Thanks Joakim.

    I appreciate the summary so that I can make an informed decision on how to approach scala development. It is inefficient for everyone try each ide and discover these things for themselves.

    I do agree that the ide and plug-in versions are important to include.

  4. Tim

    Half a year after the above post, I’m still shocked at how badly the Scala plug-in for Eclipse behaves. I’ve downloaded several variants on Eclipse over the last half-year (currently 3.4.2), and NONE of them have been able to do even basic things reliably with the Scala plug-in (or vise-versa).

    For example, F3 (go to declaration of class or method) or code completion frequently fails, crashing the plugin (errors from ch.epfl.lamp.sdt.core). The most simple Lift demo fails to compile correctly. I’ve had trouble getting a Main object to compile and launch. The ‘development’ version of the plug-in is at 2.8.0.r4 (stable is at works not at all (as promised, admittedly) with the base eclipse. At least in my experience.

    Scala looks like a promising language, but perhaps it’s just a bit too “hard” for most IDEs to handle? I can live without refactorings (etc) and other fancy options, but without, say, basic knowledge of code (how to find a referenced method) and the ability to run more than five minutes, I might as well go back to Vim. (Which I think I’m going to have to do.) (Or give IntelliJ a try and consider forking out some serious cash.)

    Thanks much for the review, though.

  5. econoplas

    The latest Scala 2.7.6 plugin version seems to be working very well within Eclipse 3.5 Galileo. They aren’t kidding when they say you need to use JDK 1.6.0_14 or later. Things like Tim reported above didn’t work on JDK 1.5.0_16 so I upgraded to 1.6.0_16 and all is well now. Pay special heed to the minimum required versions of the plugin, or your bound to have problems.

  6. Wm. Bainbridge

    Scala seems to be extremely well thought out, but it isn’t going to achieve wide acceptance without become a quick way for individuals and teams to write web projects. That means very good IDE support not only for Scala, but also for Lift. Trying to do everything through Maven adds a level of complexity, configuration and structural inconvenience that is not acceptable for most of us when compared with the IDE support for Grails, Spring/Hibernate and Struts. I first started looking at Scala over 6 months ago, and nothing has moved in that time. Too bad, but it means I can’t commit the time to work with it, because I won’t have the time to expand and maintain Scala/Lift projects without good IDE support that is independent of Maven.

Leave a Reply