问题
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:
回答1:
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.
回答2:
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.
回答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)
来源:https://stackoverflow.com/questions/14719854/how-to-add-new-jvm-languages-e-g-scala-clojure-fantom-groovy-to-eclipse-ide