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:
To use a Java class in 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.