This article is for developers who want to develop web-apps with Play 2 Framework but are required to integrate these new web-apps in an existing build process based on Maven.
Lucky you, someone already started a project to do this: play2-maven-plugin.
Unfortunately, this Maven plugin does not support hot reloading yet, which makes the development process painful.
To make it short, you still need SBT to enjoy Play 2 hot reloading feature... but you do not want to have to maintain both Maven and SBT configurations.
The trick is to configure SBT from Maven pom files with sbt-pom-reader.
This is how you need to configure your play2-maven project:
Each of the files should have the following contents.
pom.xml:
build.sbt:
project/build.properties:
project/build.scala:
project/plugins.sbt:
Lucky you, someone already started a project to do this: play2-maven-plugin.
Unfortunately, this Maven plugin does not support hot reloading yet, which makes the development process painful.
To make it short, you still need SBT to enjoy Play 2 hot reloading feature... but you do not want to have to maintain both Maven and SBT configurations.
The trick is to configure SBT from Maven pom files with sbt-pom-reader.
This is how you need to configure your play2-maven project:
<my-maven-project>/
pom.xml <- Your maven build
build.sbt <- the sbt Play 2 configuration
project/
build.properties <- the sbt version specification
build.scala <- the sbt build definition
plugins.sbt <- the sbt plugin configuration
.. <- Whatever files are normally in your maven project.
Each of the files should have the following contents.
pom.xml:
@see
play2-maven-plugin usagebuild.sbt:
play.Project.playJavaSettings //or play.Project.playScalaSettings
project/build.properties:
sbt.version=0.13.0
project/build.scala:
object BuildFromMavenPomSettings extends com.typesafe.sbt.pom.PomBuild
project/plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "1.0.1")
Now you can use Maven to build your Play 2 application and SBT to develop it with hot reloading.
Happy coding!
Source: https://github.com/sbt/sbt/issues/1123
Comments
Post a Comment