Scala Plugin
Scala Plugin for IntelliJ IDEA and Android Studio
News
Project configuration explained
Although the work on new Scala project configuration is still in progress, a brief clarification may come in handy.
- A module that requires compiling with Scalac should have a Scala facet attached.
- Facet refers to “Compiler library” which is used to instantiate Scalac inside JVM (the library provides “compiler classpath” that is completely separated from “project classpath”)
Compiler library (usually) should include scala-compiler*.jar and scala-library*.jar.
For special purposes, compiler library may include directories (like “/build/classes/”, etc), in that case, no library validation is performed. - Facet holds custom compiler options and a list of Scalac plugins (relative paths allowed).
- As usual, modules that use Scala standard library should include it in module dependencies.
- Both compiler library and standard library may be created using build-in wizard (from Scala distribution).
- Plugins doesn’t include bundled Scalac anymore.
- Maven projects can be imported automatically.
To create a new project that uses Scala:
- In “New Project” wizard check “Scala” in technologies list.
- Provide a path to Scala installation (if not detected)
To add a new module that uses Scala into existing project:
- In “Add Module” wizard check “Scala” in technologies list.
- Provide a path to Scala installation (if not detected)
To add Scala support to existing module:
- Right-click the module in Project View, choose “Add Framework Support…”
- Check “Scala” in technologies list (unavailable if module has Scala facet attached)
- Provide a path to Scala installation (if not detected)
To manually configure existing module:
- Create library “scala-compiler”:
Classes: scala-compiler.jar; scala-library.jar - Create library “scala-library”:
Classes: scala-dbc.jar; scala-library.jar; scala-swing.jar
Sources: scala-dbc-src.jar; library-src.jar; swing-src.jar
Docs: /doc/scala-devel-docs/api/
(if you downloaded Scala as an archive, you need to get separate API docs archive and extract it so that <scala home>\doc\scala-devel-docs\api exist; if you installed Scala using LzPack, then API docs are already there) - Add Scala facet to the module, select “scala-compiler” library as compiler library
- Add “scala-library” to module dependencies.
Hints:
- Don’t add Scala compiler library to module dependencies (unless you really need Scala compiler classes in your code)
- Don’t forget to attach “scala-library*.jar” to Scala compiler library, it’s a dependency of “scala-compiler*.jar” itself.
Screenshots
Scala support for existing module:
Wizard (on new project, on new module, after “Add Framework Support…”):
Module dependencies:
Autocompletion (Scala standard library):
Documentation lookup (Scala standard library API docs):
Definition lookup (Scala standard library sources):