12

So I've been trying to get IDEA 12.0 to work with Play 2.1.0 and Scala 2.10.0. I've just about given up because it's not working for me the way I want it to. Here is a copy of my build.properties, Build.scala, and plugins.sbt. I followed the approach on the playframework site to execute idea with-sources=yes in the play console. I've also tried adding sbt-idea plugin version 1.3.0-SNAPSHOT as seen in plugins.sbt, but nothing seems to work if I want to reference a new view template I just created or a new route. The only way I can work in IDEA is if I have a console open and run sbt compile, go back to IDEA, and it will refresh itself and recognize the new view templates or routes.

plugins.sbt

logLevel := Level.Warn

scalaVersion := "2.10.0"

// The Typesafe repository 
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Sonatype snapshots to get sbt-idea 1.3.0-SNAPSHOT
//resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
//addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0-SNAPSHOT")

build.properties

sbt.version=0.12.2

Build.scala

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "admin-application"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    jdbc,
    anorm
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here      
  )
}
Adrian Rodriguez
  • 3,232
  • 2
  • 24
  • 34
  • That's how I work. What's the big deal? Idea can't compile .scala.html files. You also can try to have Play running with "~run", which will compile files as soon as they are written. Not sure Idea will detect these new files right away. – pedrofurla Mar 03 '13 at 03:15
  • Yah it's not entirely a huge deal at the moment. I suppose the plugin will be updated soon enough and make this step unnecessary. Thanks for the input – Adrian Rodriguez Mar 03 '13 at 03:17
  • What version of the plugins are you using? They are having some massive problems with the plugins right now. Check this out: http://stackoverflow.com/questions/17329977/intellij-play2-and-scala-plugins-are-not-compatible-makes-intellij-12-no-longer – jakob Aug 13 '13 at 13:28
  • if my answer solved you question, please mark as resolved, thanks. – teemoo Sep 01 '16 at 12:20

3 Answers3

14

If you use IDEA Community edition, there is a SBT Console plugin (see http://plugins.jetbrains.com/plugin?pluginId=5007) that allows you to compile / run your Play project directly in the editor. That's the way I work every day and it is fine (I use the ~run command and then don't care anymore).

You may also add a remote debugger in IDEA that listens to you local server (it it is run with debug mode on) and use it as usual.

If you use IDEA Ultimate edition, JetBrains released a Play Framework plugin that seems to work fine (but I haven't tested it yet). Have a look at these tutorials:

Hope this helps.

teemoo
  • 881
  • 10
  • 16
0

I think this is how it work currently. As suggested by @pedrofurla, you can keep ~run running on sbt/play console. Sadly, IMO there is no other way IntelliJ can compile your scala views automatically.

Garbage
  • 1,490
  • 11
  • 23
0

Just add to project/plugins.sbt the following and re-run play idea

   // FIX SBT IDEA  PLAY 2.1  
   resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"  

  // Use the Play sbt plugin for Play projects  
   addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
fmendez
  • 7,250
  • 5
  • 36
  • 35
  • With the latest version of Playframework this «trick» is no longer needed. http://www.playframework.com/documentation/2.2.x/Migration22 – Lord of the Goo Oct 21 '13 at 17:51