I've just managed to get the Scala plugin to build with IDEA itself. As it's not obvious, I thought I'd document it for anyone else attempting to do it.
- Download and install a current IDEA EAP or CE. (I used Maia CE 90.06 from http://www.jetbrains.org/display/IJOS/Download)
- Download and install a Scala 2.8.0 binary installation. (I used the latest from http://www.scala-lang.org/node/212/distributions)
- Download and install Ant (from http://ant.apache.org/)
Before setting up IDEA, check that it builds with ant:
Building from ant:
- Check out the plugin source from git: $ git clone git://git.jetbrains.org/idea/scala-plugin.git
- Edit scala.properties in the checked out root directory, setting the following:
- idea.home=<IDEA home dir>. e.g. on OS X: /Applications/Maia-IC-90.96.app
- jdk.home=<JDK home dir>. e.g. on OS X: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
- scala.lib=<Scala lib dir>. Must be a 2.8.0 distribution (as per above). e.g. on OS X: /Users/andrew/dev/scala/scala-2.8.0.r19155-b20091020023404/lib
- build.number=<Some number>. Not sure if it has to be in any range, I just picked something close to the current release
- Build the plugin using Ant: $ ant
That should build the plugin. The dist directory will contain two .zip-archives. The binary plugin is the one you can install. e.g. scala-intellij-bin-0.3.xx.zip
Installing in IDEA:
- Unzip the content of *-bin.zip to the appropriate IntelliJ plugin directory: (Replace IntelliJIdea90CE with the correct version of IDEA you are using)
Mac: ~/Library/Application\ Support/IntelliJIdea90CE/
- Restart IDEA
This is optional, but is a good way to explore the plugin.
Building within IDEA:
- Open the project file in the plugin root directory (Scala.ipr)
- Go to the Project Structure (File -> Project Structure)
- Click on "Project" in the left panel and change the Project SDK.
Click on "New" and select "IntelliJ IDEA SDK".
Select the home directory of the IDEA installation. e.g. /Applications/Maia-IC-90.96.app
Select a 1.6 JDK to use within it
- Edit the newly created SDK. (Click "Edit"). Add the following .jar files from the IDEA installation:
- Click on "Global Libraries" in the left panel to define a "Scala SDK" library:
Click the plus button to add a new library (make sure you call it "Scala SDK").
Apply it to all modules in the project (it should replace the existing undefined one)
Add the following .jar files from the scala distribution: scala-compiler.jar, scala-library.jar and scalap.jar
- Click OK, to apply the Project Structure changes
You should now be able to build the plugin with IDEA, using Make and Build from the Build menu.
- Running tests: Right-clicking on tests and attempting to run them doesn't work. I suspect it is probably due to missing .jar files that need to be added to the IDEA SDK definition.
Anyway, I hope this helps others who are curious to explore/hack the Scala plugin. Hopefully an official guide will be out soon from the IntelliJ guys (hint, hint :-))