Reputation: 529
Is there a plugin that can be used to generate war from a Play Framework Project?
c:\>myproject>play war
Command mentioned above does the war generation but when deployed on Weblogic or Websphere, it does not get deployed. Tried it in the past but was not successful in getting the deployment successful.
Upvotes: 1
Views: 4394
Reputation: 51
This page will certainly help you to understand about the configurations required for generating war files... https://github.com/play2war/play2-war-plugin/wiki/Configuration
Generally you have to make changes at places for adding configurations:
1. plugins.sbt(project-root/project/)
2. build.sbt (project-root)
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.4-beta1")
build.sbt
import com.github.play2war.plugin._
libraryDependencies ++= Seq(
"com.github.play2war" % "play2-war_2.9.1" % "0.8.2" # Change version
)
Play2WarPlugin.play2WarSettings
Play2WarKeys.servletVersion := "2.5" # Change as per your requirement(3.0 or 3.1 etc)
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.4-beta1")
Run [ sbt war]
Upvotes: 1
Reputation: 529
Referred : https://github.com/dlecan/play2-war-plugin
Two files were modified to get the same working / to enable deployment of the Play App as a WAR.
1) under "/playframeworkProject/project/plugins.sbt" add the following at the bottom
// Added for WAR deployment support
addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.2-beta1")
2) under "/playframeworkProject/project/Build.scala"
import com.github.play2war.plugin._
Make following code changes.
object ApplicationBuild extends Build {
.
.
.
lazy val main = play.Project(appName, appVersion, appDependencies)
.settings(Play2WarPlugin.play2WarSettings: _*)
.
.
resourceDirectory in IntegrationTest <<= baseDirectory /"it/resources",
Play2WarKeys.servletVersion := "3.0")
.
.
}
Should finally look something like >>>
object ApplicationBuild extends Build {
import com.mckesson.builder.Resolvers._
val appName = "YourPlayProjectName"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = com.companyname.builder.Dependencies.YourPlayProjectName
resolvers := com.companyname.builder.Resolvers.XYZResolvers
lazy val main = play.Project(appName, appVersion, appDependencies)
.settings(Play2WarPlugin.play2WarSettings: _*)
.settings( playCommonSettings: _*
).configs( IntegrationTest ).settings( Defaults.itSettings :_*)
.settings(scalaSource in IntegrationTest <<= baseDirectory /"it" ,
scalaSource in Test <<= baseDirectory /"test",
resourceDirectory in IntegrationTest <<= baseDirectory /"it/resources",
Play2WarKeys.servletVersion := "3.0")
}
Re-build project's via sbt clean publish-local cd to YourPlayProjectName directory Run play war or sbt war to generate a WAR
Go to YourPlayProjectName/target/ to find the WAR
Re-name the WAR to ROOT.war
Copy it your Tomcat 7’s webapps folder
Note that you need to define CATALINA_HOME environment variable and add it/bin to your Path
Example: C:>echo %CATALINA_HOME% C:\apache\apache-tomcat-7.0.40 4. Start your database
5. Start Tomcat 7 with this command from your command prompt (no specific location as long as your CATILANA_HOME is set correctly in your environment variable) catalina start
6. Start your other dependencies if any to make sure your application works.
In the browser, hit http://:8080 to see your application working and deployed successfully.
Enjoy!!
Upvotes: 1
Reputation:
In case your project is based on play framework 2.x this plugin worked for me in the past: https://github.com/dlecan/play2-war-plugin
Have been successfully using it with play version 2.1.1.
Upvotes: 1