Play Framework 2.0 WAR Plugin
Switch branches/tags
Nothing to show
Pull request Compare This branch is 638 commits behind play2war:develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

WAR Plugin for Play framework 2.0

Current version: 0.3.2

Project-status: ALPHA

This project is a module for Play framework 2 to package your apps into standard WAR packages.

As of version 0.3.1, it is only compatible with Play2 2.0.1.

Live demo: JBoss7@Cloudbees :

Other references built with Play 2 and Play2War:


Feature Native Play 2 Servlet engine
3.0 2.4/2.5
Available ?
HTTP Asynchronous request
HTTP 1.0/1.1
Chunked response TBD TBD
Web Socket
Container Data sources Built-in
(Bone CP)
Built-in (Bone CP)
External DS support : TBD
Root context path
Eg: http://local/
Non root context path
Eg: http://local/myAppContext
2.0.x :
2.1.x (alpha) :

TBD for Play 2.1
WAR customization
(web.xml, ...)

Server compatibility

Servlet engine Server Standalone deployment PaaS
Servlet 3.0 Tomcat 7 Demo @Jelastic
JBoss 7.0 Demo @Cloudbees
Need extra configuration when deploying
JBoss 7.1 TBD TBD
Glassfish 3 TBD TBD
Servlet 2.4/2.5 Tomcat 6 TBD TBD
Jetty 6 TBD TBD

The plugin may work on others containers, such as Weblogic or Websphere (not tested yet).


In the next descriptions, APP_HOME is the root of your Play 2.0 application you want to package as a WAR file.

Add play2war plugin

In APP_HOME/project/plugins.sbt, add:

resolvers += "Play2war plugins release" at ""

addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "0.3.2")

Add play2war runtime

In APP_HOME/project/Build.scala, modify appDependencies and main values to add:

val appDependencies = Seq(
  "com.github.play2war" %% "play2-war-core" % "0.3.2"

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
  resolvers += "Play2war plugins release" at ""

Configure logging

You probably need to override default Play 2.0 logging configuration because :

  • An external file will be written in $USER_HOME/logs/...

  • STDOUT appender pattern can be improved

Create a file APP_HOME/conf/logger.xml with the following content :

  <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
  <logger name="play" level="INFO" />
  <logger name="application" level="INFO" />
  <!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
  <logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
  <logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF" />
  <logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF" />

  <root level="ERROR">
    <appender-ref ref="STDOUT" />


If Play runtime is available, run

play war

Your WAR package will be available in APP_HOME/target/<MY_PROJECT>_version.war

How to deploy in your favortie application server

Play framework 2.0.x applications must be deployed at root context. Deployment in a sub-context is a known limitation which is fixed for Play 2.1 (still in development).

The best way to deploy at root context is to include a configuration file into the WAR file to indicate to your application server where to deploy the application. But Play2War doesn't support file inclusion yet (see #4).

How to deploy at root context in Tomcat 7

Rename the generated war ROOT.war before deployment.

How to deploy at root context in Jetty 8

Rename the generated war ROOT.war before deployment.

How to deploy at root context in JBoss 7.0.x

In standalone/configuration/standalone.xml, remove the bean named urn:jboss:bean-deployer:2.0.

Then follow explanations for JBoss 7.1.X below.

How to deploy at root context in JBoss 7.1.x

First, disable default welcome page in standalone/configuration/standalone.xml by changing enable-welcome-root="true" to enable-welcome-root="false":

<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
  <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>
  <virtual-server name="default-host" enable-welcome-root="true">
    <alias name="localhost" />
    <alias name="" />

Then rename the generated war ROOT.war before deployment.

Upload or deploy your WAR file

Upload or deploy your WAR file to your favorite Application Server if compatible (see Compatibility matrix above).


See FAQ.


Please file issues here:

Continous integration

Watch it in action here :

How to help ?

Discover how you can help the project.


This software is licensed under the Apache 2 license, quoted below.

Copyright 2012 Damien Lecan (

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Built by CloudBees