I am always a fun of Intellij until it throws at me a bomb when working with play framework.
This post is served at the purpose of solving (at least listing) some of the problems I encountered.
- Play Console [p>]: play create myapp with Java by `play new [a project name]`
- Import play project using IntelliJ through play console by `idea with-sources=yes` and then import from intelliJ
- Follow the “todo” play tutorial
- “cannot resolve symbol” for reverse routing: As in
return redirect(routes.Application.tasks());. It is related to the fact that part of folder target, i.e. target/scala-2.10/src_managed (some scala code compiled by play compile) is not included as the source. So do “play compile” before importing into IntelliJ, and IntelliJ will notify you that
You have useless source roots which may corrupt resolve for play 2 framework in your project. Don’t delete but ignore the warnning.
Execute the following steps to update your dependencies [Solution provided in Github]:
- Run the update task from your play console
- Remove the .idea_modules and .idea/libraries directories
- Run the idea with-sources=yes command in the play console
@form(routes.Application.newTask()): simply add class_managed to the class path.
Working on play 2.3.0 with IntelliJ
Install plugin, scala, Play 2.0 support, SBT(optional)
activator> compile > test:compile > idea withsources=yes
open build.sbt > IntelliJ asks me to associate this build.sbt with project, do import
change IDE language levels if necessary.
Check IDE preference for play, sbt, scala.
Run a JUnit method test by IDE; Debug with Play 2 better than activator -jvm-debug 9999 run.
IDE will automatically create root and root-build in project modules.
NOTE: 2.10.4 is used instead of scalaVersion specified in build.sbt (Unsolved)
Install https://github.com/jrudolph/sbt-dependency-graph following the readme ‘s two steps, and within play run the tasks.
Warning: Class path contains multiple SLF4J bindings. slf4j-log4j12 conflicts with logback. Use dependency-graph to identify who is using log4j.