How to build Scala plugin for IntelliJ IDEA from scratch

Skip to end of metadata
Go to start of metadata
It is outdated version of page. It can give you some hints, but not a complete reference.

1. Clone the Scala plugin Git repository : 

2. Modify file to set up specific Java, IntelliJ IDEA and Scala SDKs. Make sure, that idea.home points to the last IDEA EAP (may be downloaded from the EAP page) and

Scala distribution has version 2.8 (last nightly builds are available on the official Scala site)


4. Run ant from command line. Directory dist with two .zip-archives in the plugin's project folder will be created. Unzip the content of * to the appropriate IntelliJ plugin directory:

Windows: $USER_HOME/.IntelliJIdea90/config/plugins

Linux: ~/.IntelliJIDEA90/config/plugins

Mac: ~/Library/Application\ Support/IntelliJIDEA90/

5. Restart IntelliJ IDEA.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 01, 2009

    I've just tried it on Mac. The jdk.home as above points to Java 1.5, although 1.6 is available alongside – does it make a difference here?

    Now trying to compile, I get 2815 errors! Starting with,

    [scalac] /s/w/scala/idea/src/org/jetbrains/plugins/scala/annotator/ScalaAnnotator.scala:6: error: not found: value highlighter
    [scalac] import highlighter.{AnnotatorHighlighter}
    [scalac] ^

    – that's using scala-2.8.0.r18418-b20090731020235:


    – by the way, the above doesn't show scala.lib pointing to a .../li

    Is SVN broken against

    1. Aug 11, 2009


      This is about new scala 2.8 ideology with nested packages. Current trunk version compiled well with latest compiler version.

  2. Nov 03, 2009


     I've tried to compile plugin on Windows using scala-2.8 (build 19360), IDEA Community Edition 90.137 and JDK 1.6.0_16.

    I get following error:

    Buildfile: build.xml


        [mkdir] Created dir: C:\scala-plugin\classes\production\Scala
        [mkdir] Created dir: C:\scala-plugin\classes\production\Scala\META-INF
        [mkdir] Created dir: C:\scala-plugin\classes\production\Runners
         [copy] Copying 2 files to C:\scala-plugin\classes\production\Scala\META-INF
         [copy] Copying 30 files to C:\scala-plugin\classes\production\Scala
       [javac2] Compiling 6 source files to C:\scala-plugin\classes\production\Runners
       [javac2] Note: C:\scala-plugin\Runners\src\org\jetbrains\plugins\scala\compiler\rt\ uses unchecked or unsafe operations.
       [javac2] Note: Recompile with -Xlint:unchecked for details.
       [javac2] Added @NotNull assertions to 0 files
       [scalac] Compiling 1 scala and 1 java source files to C:\scala-plugin\classes\production\Runners
       [scalac] object scala not found.
       [scalac]     at$definitions$.getModuleOrClass(Definitions.scala:456)
       [scalac]     at$definitions$.ScalaPackage(Definitions.scala:43)
       [scalac]     at$definitions$.ScalaPackageClass(Definitions.scala:44)
       [scalac]     at$definitions$.UnitClass(Definitions.scala:67)
       [scalac]     at$definitions$.init(Definitions.scala:728)
       [scalac]     at$Run.(Global.scala:664)
       [scalac]     at$.process(Main.scala:109)
       [scalac]     at$.main(Main.scala:124)
       [scalac]     at
       [scalac] error: fatal error: object scala not found.

    C:\scala-plugin\build.xml:177: Compilation failed because of an internal compiler error; see the error output for details.

    What can I do to get rid of this and to build plugin? Any help will be gladly appreciated.

    1. Dec 01, 2009

      Thanks a lot for your help...

      1. Dec 01, 2009

        You'll have a much better chance of getting help if you post your question to the official plugin discussion forum:

        1. Dec 01, 2009

          Thanks. Now really thanks a lot.

  3. Nov 06, 2009


    I get the following error when trying to build te plugin (Maia-IC-90.154, Scala 2.8.0.r19413-b20091106100043, Java 1.6.0_15, OSX/Snowleopard).

    Trying to override old definition of task same
    [scalac] Compiling 824 scala and 96 java source files to /Users/pmaas/dev/scala/idea/scala-plugin/scala-plugin/classes/production/Scala
    [scalac] /Users/pmaas/dev/scala/idea/scala-plugin/scala-plugin/src/org/jetbrains/plugins/scala/lang/refactoring/inline/ScalaInlineHandler.scala:37: error: class ScalaInlineHandler needs to be abstract, since method removeDefinition in trait InlineHandler of type (x$1: com.intellij.psi.PsiElement,x$2: com.intellij.lang.refactoring.InlineHandler.Settings)Unit is not defined
    [scalac] class ScalaInlineHandler extends InlineHandler {

    Unknown macro: {/code}
  4. Nov 06, 2009


    Uggh... sorry for that. Seems Chrome isn't the best browser to post comments here

    I get the following error when trying to build te plugin (Maia-IC-90.154, Scala 2.8.0.r19413-b20091106100043, Java 1.6.0_15, OSX/Snowleopard).

  5. Nov 06, 2009


    I managed to fix the above by altering 'ScalaInlineHandler#removeDefinition' to reflect the new interface:

  6. Nov 10, 2010

    I'm getting this error while building the latest (dc2142e5d2878a5c8160823d124a48320c4fe6f2) on OS X:

    My looks like this:

    I'm using java "1.6.0_22"
    Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
    Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)

    The problem seems to be in scalac ant task (for scala 2.7) and it doesn't seems to accept jvmargs attribute (which scalac 2.8 does):

    If I comment-out the 2.7 build section the the build get further but then fail as follows:

    Any ideas ?

    1. Nov 10, 2010

      I managed to get pass the scalac 2.7 OOM error by using setting the following:

      I also tried to switch to IDEA 9.0.3 CE but got even more failures: