A lot of feedback (tracker, forum, twitter, blogs) suggest that the legacy (facet-based) way of configuring Scala in IDEA is too confusing for most new users. Moreover, such approach has several inherent shortcomings.
The following limitations were discovered:
- there’s no natural connection to Scala distribution (that is the only “Scala” most novices know),
- initial wizard doesn’t download sources and API docs (so it’s a disservice),
- duplication is required (module needs both Scala facet and Scala library attached),
- possible mismatch between compiler and libraries versions (because of the separation),
- facet can’t be referenced (so there’s no way to share the same compiler configuration between modules).
Having regard to the above-listed problems, we decided to re-design Scala configuration. The new method assumes the following:
- Scala "SDK" is a special library that includes scala-library*.jar. It unites jars, sources, API docs and compiler.
Scala "SDK" can be automatically created from Scala distribution (with all jars, sources and API docs). Distribution directory may be automatically located using SCALA_HOME or PATH environment variables (see Getting Started With Scala). API docs are expected to be placed to “docs” directory inside distribution home (SCALA_HOME/docs/api should exists).
- Any module that includes such "SDK" library in "Dependencies" is meant to be compiled using Scala compiler associated with attached library.
- Compiler is discovered implicitly, either in the same directory that holds scala-library*.jar, or in the Maven repository (still, relatively to attached scala-library*.jar). Scala compiler library may (or may not) be explicitly attached to Scala SDK.
- Scala "SDK" can be shared between modules. Global, project-level and module-level SDKs are allowed. Each module may use its own version of Scala.
- Scala "SDK" can be created manually.
Here's an example of library creation wizard (project or new module creation):
Facets are now obsolete and may be deleted (using “Delete” button below “Error loading facets” message).
Don't forget that "Scala SDK" is not a real SDK in IDEA, it's a library, for all that.
The solution isn't perfect (because we somehow limited by IDE configuration primitives), but it seems to be the lesser evil. We hope that the new approach will make project configuration more straightforward (as well as it will simplify initial IDEA + Scala setup for newcomers).
P.S. Bugs happen, you know... Please, report them to our tracker.