Version 11, last updated by Iulian Dragos at November 16, 2011 12:03 UTC

You can develop the IDE inside Eclipse, build and run a second instance of Eclipse, or run the tests using the JUnit Test runner. Here's a step-by-step guide.

Requirements

At the time of this writing (Nov. 2011), the plugin sources are incompatible with Indigo. You have to use Eclipse 3.6.2. We recommend Eclipse Classic.

Import Scala IDE projects into your workspace

Assuming you already cloned the github repository from https://github.com/scala-ide/scala-ide, you just need to import the necessary projects inside your workspace.

  • Click on Eclipse/Import and choose Existing project
  • Import some of the org.scala-ide projects (you need at least org.scala-ide.sdt.core, org.scala-ide.sdt.core.tests, org.scala-ide.sbt.full.library).
  • You will notice that the org.scala-ide.sbt.full.library has build path errors. This project is grouping together a bunch of SBT jars into one OSGI bundle. In order to retrieve them from different SBT/Ivy repositories, you need to go to the command line and run build-toolchain-<version>.

       $ cd org.scala-ide.build-toolchain
       $ ./build-toolchain-2.9.x.sh  # or build-toolchain-trunk.sh
    

(you need to use the same Scala version in the toolchain call as the one installed in your Eclipse installation).

  • Refresh the org.scala-ide.sbt.full.library. The build error should be gone, if you're using the 2.9 version. If not, you need to remove all the jars in the build path, and re-add the ones using 2.10.0 in their names.

Make sure all of them are exported.

  • Clean-build org.scala-ide.sdt.core and org.scala-ide.sdt.core.tests.
  • Start hacking.

Set up a run configuration for launching Eclipse with Scala IDE

To usual way to test an Eclipse plugin is to launch a second instance of Eclipse using the plugins in your workspace. Since Scala IDE uses weaving, you need to launch the IDE with weaving enabled, which is not configurable in the vanilla launcher.

  1. Install the Equinox Weaving launcher. You can find an update site at the bottom of http://download.scala-ide.org This adds two more launch configurations: Eclipse Application with Equinox Weaving, and JUnit plugin test with Equinox Weaving. To create a run configuration, follow the usual steps, but instead of the plain Eclipse Application/JUnit Plugin test configuration choose the one with Equinox Weaving. This makes the launched Eclipse instance use weaving.

  2. Create a new launch configuration choosing the Eclipse Application with Equinox Weaving.

  3. Check the Plugin page to see if the required plugins are enabled, and if it's picking up the workspace projects instead of the default (platform) ones (use the 'Validate Plugins' button).
  4. Run/Debug and be happy!

This is all there is to it: you can configure the launcher using the normal tab (check the Plugins section to make sure it uses the sdt.core bundle from your workspace, and the necessary dependencies (usually org.scala-ide.scala.library and org.scala-ide.scala.compiler are also enabled).

Create a JUnit test runner configuration

Just like above, you need the Equinox Weaving launcher. Then,

  1. Create a new launch configuration choosing JUnit plugin test with Equinox Weaving launcher.
  2. On the Main page, in the Program to Run box, select [No Application] - Headless mode
  3. On the Arguments page, in the VM Arguments box, add -Dsdtcore.headless (this keeps the diagnostics window from appearing).
  4. Choose org.scala-ide.sdt.core.tests as the project, and any of the test classes (or scala.tools.eclipse.TestsSuite for all tests).
  5. Run/Debug and be happy!

Running the tests should not spawn a new Eclipse window (if they do, something is wrong). If your test spawns a new Eclipse window, you are using UI APIs, and your test will fail during the Jenkins nightly build.

org.scala-ide.sdt.aspects

If you need to work on this plugin, you also need to install the AspectJ plugin.

Using JRebel

If you are lucky enough to use JRebel, there are two things you need to know:

  1. You can simply add -noverify -javaagent:path/to/javarebel.jar to the VM arguments in the run configuration. For Windows, this is -noverify "-javaagent:C:\Program Files (x86)\ZeroTurnaround\JRebel\jrebel.jar"
  2. JRebel is free for Scala users, see Free JavaRebel for Scala users, ZeroTurnaround announces