user2786785
user2786785

Reputation: 25

Play 2.2.0 - How to create a war file

I am using play 2.2.0 for my application so inorder to host the application i need to create a war file so i can host in my Tomcat7 server. So is there any method to

  1. Clean and Build as we have options in netbeans with console.
  2. Create war file so i can host.
  3. The method to create a war file as in normal jsp hosting i paste all my class files in WEB_INF folder but here how can i do please tell the procedure. I just gave few try this i have mentioned below i know i am wrong please show me the right way.

    F:\Play_workspace\ThemePractice>play war [info] Loading project definition from F:\Play_workspace\ThemePractice\project [info] Set current project to ThemePractice (in build file:/F:/Play_workspace/Th emePractice/) [error] Not a valid command: war (similar: start) [error] Not a valid project ID: war [error] Expected ':' (if selecting a configuration) [error] Not a valid key: war (similar: watch, run, apiUrl) [error] war [error] ^

Upvotes: 2

Views: 4347

Answers (3)

EdwinR
EdwinR

Reputation: 55

Add addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.2-beta4") to your plugins.sbt

Add the following to your build.sbt

import com.github.play2war.plugin._

libraryDependencies ++= Seq(
  "com.github.play2war" % "play2-war_2.9.1" % "0.8.2"
)


Play2WarPlugin.play2WarSettings

Play2WarKeys.servletVersion := "2.5"

Now you can freely use the "play war" command.

Upvotes: 0

Kai Sternad
Kai Sternad

Reputation: 22830

There is a plugin for creating a war file, however Play 2.2.x is currently not supported.

Although a branch exists on Github for this feature, it looks like it is still being worked on. You'd have to contact the maintainers for a time line.

Update: It is now possible to create a war file with Play 2.2.x, see Paul D. Eden's comment.

Upvotes: 6

R.B.
R.B.

Reputation: 537

Play 2.1.4 onwards, support for packaging into a war file has been withdrawn. There is a workaround for the same which can help you in generating war file. You fool the compiler and let it think that we are using earlier version of Play. For details refer to the following link :-

Create War from Play 2.2.1 application

It is working till day for me :)

Upvotes: 1

Related Questions