My last post focused on how and why I picked IntelliJ Idea to be my Scala-IDE.
This short post illustrates on how I am using it.
The only things required are a working installation of Maven (2.x or 3.x for added flavor) and IntelliJ 10. I expect people reading this blog to be able to install both so I won’t spend time on this.
For some reasons Idea wouldn’t pick up my Maven installation (even when using the overrides). Looks like this is a known problem. The fix is a little invasive but pretty simple:
- Do ‘sudo su’ to become root
- edit/create the file ‘/etc/launchd.conf’
- insert ‘setenv M2_HOME <path-to-maven-install>’
- restart
After starting the IDE we need to add the Scala Plugin. Go to Preferences -> Plugins and seelect the Scala Plugin, not the Scala Power Pack.

After installing we can now continue to create a new Scala project. As we want to use Maven we will use the Maven archetype.
Create a new project with ‘Create project from scratch’, then select ‘Maven Module’. In the following screen select the org.scala-tools.archetypes:scala-simple-archetype and continue. The resulting project is a Maven-Java project and we need two things to turn it into the Scala project we wanted.
First thing to do is to change the Scala version in the pom.xml.
<br /><br /> <properties><br /> <scala.version>2.6.1</scala.version><br /><br /> </properties><br />
Simply replace 2.6.1 with 2.8.1.
Now we need to turn the project into a Scala project. Right-click on the project and select ‘Add Framework Support…’
And adjust the following screen to look like this:
We are almost there.
The last remaining step in Idea is to turn off compilation from the IDE.
Create a run configuration and open it. Uncheck ‘Make’ in ‘Before Launch’.
The only thing remaining is to start the continuous compile.
Open a terminal, cd to the directory with your new project (the one containing the pom.xml) and execute ‘mvn scala:cc’.
Maven will now watch the project for changes and compile everything that changes.
Now back to the 99.


There are more useful commands, for example mvn scala:cctest for testing or mvn scala:console for console, which can be integrated with JRebel.
BTW: I’ve tried scala-archetype-simple, but it is really old. Fortunately, there is a new version (1.3) which can be added by Add archetype.
You can watch new versions at http://www.mvnbrowser.com/artifact-details.html?groupId=org.scala-tools.archetypes&artifactId=scala-archetype-simple&version=1.3&tab=VERSIONS .
By the way, I’ve never needed to add framework support. It seems to be better to enable auto-import, which is an option availble when editing pom.xml.