How to add new JVM languages e.g. Scala, Clojure, Fantom, Groovy to Eclipse IDE?
Asked Answered
E

3

2

What's a prefereed way to download Scala , via scala-lang.org, can it be added directly by the Eclipse IDE or how to add Scala to Eclipse IDE? Is there a convention on how to add a JVM language?

Update

I could add Clojure and Scala from Help...install new software so now I can create those kinds of projects:

enter image description here

Errol answered 6/2, 2013 at 1:2 Comment(0)
A
7

You typically install a plugin for that language using Eclipse's build in plugin language.

for instance for Clojure you can search the plugin manager for "counter clockwise" to get Clojure support. for Scala it looks like http://scala-ide.org/ is a good starting point for detailed instructions and a nice screencast on setting this up. It's worth noting that many JVM languages like Clojure don't need to be explicitly installed, they are downloaded as required by standard Java build tools like Maven. Other languages like Groovy are more easily used if you install them explicity.

Albumenize answered 6/2, 2013 at 2:4 Comment(1)
It was about same way to install Clojure and Scala here. I could install Clojure and counterclockwise via "Help...Install new software" using update site ccw.cgrand.net/updatesite. Now I want to install Scala but Eclipse Juno was not supported. I could install Scala to other Eclipses than Juno. Thanks!Errol
T
5

If you're an IDEA user, by far the best way is to use SBT to manage your projects and use its sbt-idea plug-in (which adds the gen-idea task) to create IDEA projects files and directories.

Ideally, use Paul Phillips' SBT launcher (to get SBT version flexibility if you're ever going to build 3rd-party projects whose specified SBT versions can be all over the map) and configure non-project-specific plugins, such as sbt-idea, in your per-user shared ~/.sbt directory. That way all your projects have it automatically yet it does not intrude on the project definition itself.

Optionally, there is an IDEA plug-in that integrates SBT's interactive console with the IDEA app. The best part of that is compilation errors become hyperlinks to your code.

I don't know if there's an Eclipse counterpart to sbt-idea, but even if there's not, SBT is the way to go.

Torch answered 6/2, 2013 at 2:36 Comment(0)
C
3

The JVM languages typically have plugins for Eclipse, e.g. Counterclockwise for Clojure.

In many cases you can also use JVM languages without a plugin in a regular Java project. For example the following approach works with Clojure:

  • Include clojure-1.4.0.jar as a dependency (using Maven or similar)
  • Include clojure source files as regular resources in your project
  • Write a short piece of Java code that executes the clojure code by calling the appropriate methods in clojure.lang.RT (a class provided in Clojure's jar file)
Component answered 6/2, 2013 at 2:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.