Fork me on GitHub

Quickstart Guide

This page explains how to use the play2-maven-plugin to build your Play 2 application using Maven.


Create a Play 2 application using the play command:

play new myFirstApp

This command creates the Play 2 application. Obviously it's not required if you already have an existing application.


At the root of the created project, create a pom.xml file with the following content:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">




        Add your dependencies here (modules, libraries...).
        Dependencies in the compile scope will be embedded within the application.

        <!-- Play Framework Dependencies -->


        <!-- Play source directory -->







That's it !


Before starting, be sure to have the play executable in your path or to have defined the PLAY2_HOME system variable used by the plugin to find the Play 2 SDK (or check the next section). As shown in the previous pom file, the packaging of your project must be play2.

To define the PLAY2_HOME variable on Mac/Linux use:

export PLAY2_HOME=...
# or
mvn clean install -DPLAY2_HOME=...

To build the application, simply run:

mvn clean install

To compile and test only:

mvn test

To package the application without running the tests:

mvn package -DskipTests

To debug the application:

mvn play2:debug

Finally, to run the application:

mvn play2:run

Using the regular Maven structure

By default the plugin is configured to use the Play directory structure. But it can be configured to use the Maven structure. Check this page for more information.

Setting Play 2 location from the pom file

The PLAY2 location can also be defined in the pom.xml file such as in:


The plugin is checking in this order:

  • the PLAY2_HOME system variable (set with -DPLAY2_HOME=...)
  • the play2Home setting
  • the PLAY2_HOME environment variable

If PLAY2_HOME is not define, the plugin use the system PATH, and looks for the play or play.bat executable.