I upgraded my IntelliJ(12.1.4) to the new Play 2.0 Support(0.5.54) plugin and two things happened:
IntelliJ no longer recompiles my .scala classes, this meaning that if
I e.g change the signature of a method from def something(s1:
String) = {} to def something(s1: String, s2: String) = {} I get an
error that ) is expected after the first param. I run the app from
the terminal with play debug ~run
and there the app recompiles
without a problem.
The scala.html are not evaluated properly and I get a lot of syntax errors. The color encoding is also wrong. I tried to change the Scala plugin to the nightly build(0.10.281) as suggested in the comments but it still doesn't work.
This is crazy bad since it makes working with the IntelliJ painful and counterproductive. There is a bug reported: http://youtrack.jetbrains.com/issue/SCL-5749 but what should I do in the meantime? Anybody solved this issue?
Open IntelliJ IDEA, go to File Menu --> Plugins --> [ Or directly press Ctrl+Alt+S ] Click on "Browse repositories" button and enter "Scala". Select Scala plugin to install it.
In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK. Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.
To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA. Now you can successfully check out from VCS, create, or import Scala projects.
For me play2.0 version 0.2.49 with scala version 0.10.279 does the trick. With the other versions I ether get bugs, or my IDE just doesn't work correct.
link to play plugin: http://plugins.jetbrains.com/plugin/download?pr=&updateId=13272
link to scala plugin: http://plugins.jetbrains.com/plugin/download?pr=&updateId=13504
instructions:
1 download the .zip (do not extract)
2 make sure there are no play or scala plugins in your IDE folder (C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.2\plugins)
3 op the IDE and open the plugin menu. (file -> settings... -> plugins
4 click the button "install from disk" and select the play zip file and the scala zip file. (you don't need to disable the play and scala plugin in the plugin list, they get swapped after the IDE restart
5 restart your IDE
6(optional) report back here if it worked or not
Use the IntelliJ sbt plugin and compile your classes from sbt with "~compile". You can start play with "container:start".
Here is my own Build.scala file I run from within IntelliJ:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "Blade_Night_App"
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
)
}
And here the plugins.sbt:
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
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")
Additional I have a Debug configuration for a Scala application with
This replaces the Play plugin completely for me :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With