Does the Scala Plugin work with Idea?

Is anyone using the Scala Plugin with IntelliJ? I am unable to get the compiler to work and I can’t run the console from Idea.

My build.gradle looks similar to this:

apply plugin: ‘scala’

ext {

scalaVersion = ‘2.9.2’

}

//Define common test dependencies

dependencies {

scalaTools “org.scala-lang:scala-compiler:${ext.scalaVersion}”

scalaTools “org.scala-lang:scala-library:${ext.scalaVersion}”

// Libraries needed for scala api

compile “org.scala-lang:scala-library:${ext.scalaVersion}”

}

However, trying to run the console yields: No scala-compiler*.jar found, so it looks like Idea cannot figure out what to do with “scalaTools” and you have to manually set up the compiler and lib jars to actually run Scala.

Is there any documentation on how to get up and running with the Scala plugin in Idea?

You shouldn’t need ‘scalaTools “org.scala-lang:scala-library:${ext.scalaVersion}”’, as scala-compiler depends on scala-library anyway. Are you using Gradle’s IDEA plugin, or IDEA’s Gradle integration?

You may want to also use the idea-scala-facet plugin to make IDEA friendlier to Scala projects.

@Benjamin: Thanks for the tip. I checked it out and it seems to do the trick once I re-create the project from the .iml file.

@Peter: I am using IDEA’s Gradle integration along with the IDEA Scala Plugin, which is probably a subset of a subset in terms of userbase. I wanted to get a sense for if anyone else is using these together, or is this expected not to work. I have heard horror stories about SBT, so I was eager to try Gradle first. Hopefully with the idea-scala-facet, I will be ok and hopefully more users choose the Idea/Scala/Gradle path.

@Adam IDEA gradle integration (JetGradle) in version 11 does not support Scala facet integration (that’s why I made idea-scala gradle plugin in the first place). Besides that I found that JetGradle does a lot of unnecessary syncing of dependencies, which slows IDEA down, so for medium/large projects generating .iml/.ipr files works way better. Hopefully JetGradle will be improved in IntelliJ 12.

I have been using gradle+IDEA for quite a few scala projects, including Play 2 projects without writing a single line SBT script, without any trouble. You can find some samples of Play2 projects on my github page.

Improvement suggestions are always welcome!