This is a summary of the procedure for creating a new Play Framework 2.6 (Java) project and importing it into Eclipse. Since the activator command that was used up to v2.5.x has reached EOL, sbt [^ 1] will be used directly after v2.6.x.
Install sbt with Homebrew for Mac and from here for Windows. Please give me. If sbt is already included, you can check the version with the about option.
$ sbt about => [info] This is sbt 1.0.4
sbt new [Template name]Create a new project with. You will be asked for the project name and scala version, but if you press enter without entering anythingThe default value in is adopted.
$ sbt new playframework/play-java-seed.g8 [info] Set current project to play (in build file:〜〜〜) This template generates a Play Java project name [play-java-seed]: organization [com.example]: scala_version [2.12.3]: play_version [2.6.7]: sbt_version [1.0.2]:
The app is launched by sbt run, http://localhost:You can check the operation from 9000 (in the case of the first execution, it takes time because the library is dropped).
### Add settings for Eclipse Added plugin settings to project / plugins.sbt. #### **`plugins.sbt`** ```sbt addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.2")
Next, add the settings for Eclipse to build.sbt.
EclipseKeys.preTasks := Seq(compile in Compile, compile in Test) EclipseKeys.projectFlavor := EclipseProjectFlavor.Java EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources)
Generate .classpath and .project files for Eclipse.
$ sbt eclipse
You can now import it into Eclipse (File> Import> Existing Projects into Workspace). However, in the imported state in this way, Eclipse does not refer to the class generated from view (* .scala.html), so a compile error occurs in Controller. To solve this, set an additional build path.
[^ 1]: Build tool for Scala. activator used sbt internally