Play has several plugins for different IDE-s. The eclipse plugin allows to transform a Play application into a working eclipse project with the command activator eclipse. Eclipse plugin may be set per project or globally per sbt user. It depends on team work, which approach should be used. If the whole team is using eclipse IDE, plugin may be set on a project level. You need to download eclipse version supporting Scala and Java 8: luna or mars - from http://scala-ide.org/download/sdk.html.
To import Play application into eclipse:
//Support Play in Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
EclipseKeys.preTasks := Seq(compile in Compile)
activator-local: file:////${activator.local.repository-C:/Play-2.5.3/activator-dist-1.3.10//repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
activator-launcher-local: file:////${activator.local.repository-${activator.home-${user.home}/.activator}/repository}, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
activator compile
activator eclipse
Now the project is ready to be imported into eclipse via Existing Projects into Workspace.
EclipseKeys.withSource := true
Add the sbt user setting:
c:\asch\.sbt\0.13\plugins\plugins.sbt
//Support Play in Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
c:\asch\.sbt\0.13\sbteclipse.sbt
import com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys
EclipseKeys.preTasks := Seq(compile in Compile)
To debug, start the application with the default port 9999:
activator -jvm-debug run
or with the different port:
activator -jvm-debug [port] run
In eclipse:
From now on you can click on Debug to connect to the running application. Stopping the debugging session will not stop the server.