Usage - general instructions

Different Play! versions support

Plugin supports following Play! Framework versions: 2.1.x, 2.2.x, 2.3.x, 2.4.x and 2.5.x.

There are some configuration differences:

Using plugin SNAPSHOT versions

Add

            <pluginRepositories>
                <pluginRepository>
                    <id>sonatype-nexus-snapshots</id>
                    <name>Sonatype Nexus Snapshots</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                </pluginRepository>
            </pluginRepositories>

to your project or better add

<settings>
    ...
    <profiles>
        ...
        <profile>
            <id>sonatype-snapshots-repo</id>

            <pluginRepositories>
                <pluginRepository>
                    <id>sonatype-nexus-snapshots</id>
                    <name>Sonatype Nexus Snapshots</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        ...
    </profiles>

    <activeProfiles>
       <activeProfile>sonatype-snapshots-repo</activeProfile>
    </activeProfiles>
    ...
</settings>

to ~/.m2/settings.xml file. More info: http://maven.apache.org/guides/mini/guide-multiple-repositories.html

Plugin version migrations.

1.0.0-beta4 to 1.0.0-beta5 migration

Change plugin versions from

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta4</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta7</sbt-compiler.plugin.version>
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta5</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta8</sbt-compiler.plugin.version>
    </properties>

Default router generator type changed from static to injected for Play! 2.5.x projects. For Play! 2.5.x project:

a) if static router generator is required add configuration parameter:

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                    <routesGenerator>static</routesGenerator>
                </configuration>
            </plugin>

b) if injected is required, configuration parameter can be removed:

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                    <!-- remove <routesGenerator>injected</routesGenerator> -->
                </configuration>
            </plugin>

If Java classes enhancement is required add execution element with enhance goal:

1.0.0-beta3 to 1.0.0-beta4 migration

Just change plugin versions from

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta3</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta5</sbt-compiler.plugin.version>
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta4</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta7</sbt-compiler.plugin.version>
    </properties>

1.0.0-beta2 to 1.0.0-beta3 migration

Change plugin version from

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta2</play2.plugin.version>
        ...
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta3</play2.plugin.version>
        ...
    </properties>

If Java classes enhancement is required add execution element with enhance goal:

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                </configuration>
                <executions>
                    ...
                    <execution>
                        <id>default-play2-enhance</id>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

1.0.0-beta1 to 1.0.0-beta2 migration

Just change plugin version from

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta1</play2.plugin.version>
        ...
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta2</play2.plugin.version>
        ...
    </properties>

1.0.0-alpha9 to 1.0.0-beta1 migration

Just change plugin version from

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha9</play2.plugin.version>
        ...
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-beta1</play2.plugin.version>
        ...
    </properties>

1.0.0-alpha8 to 1.0.0-alpha9 migration

Just change plugin versions from

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha8</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta4</sbt-compiler.plugin.version>
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha9</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta5</sbt-compiler.plugin.version>
    </properties>

1.0.0-alpha7 to 1.0.0-alpha8 migration

Just change plugin version from

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha7</play2.plugin.version>
        ...
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha8</play2.plugin.version>
        ...
    </properties>

1.0.0-alpha6 to 1.0.0-alpha7 migration

Just change plugin versions from

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha6</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta3</sbt-compiler.plugin.version>
    </properties>

to

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha7</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta4</sbt-compiler.plugin.version>
    </properties>

1.0.0-alpha5 to 1.0.0-alpha6 migration

Remove provider from plugin’s dependencies (provider auto-discovery mechanism will add this dependency automatically). For example replace

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <dependencies>
                    <dependency>
                        <groupId>com.google.code.play2-maven-plugin</groupId>
                        <artifactId>play2-provider-play22</artifactId>
                        <version>${play2.plugin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

with

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
            </plugin>

Add sbt-compiler-maven-plugin

    <properties>
        ...
        <sbt-compiler.plugin.version>1.0.0-beta3</sbt-compiler.plugin.version>
    </properties>

    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
                <artifactId>sbt-compiler-maven-plugin</artifactId>
                <version>${sbt-compiler.plugin.version}</version>
            </plugin>
        </plugins>
    </build>

1.0.0-alpha4 to 1.0.0-alpha5 migration

No changes required.

1.0.0-alpha3 to 1.0.0-alpha4 migration

In your play2 Java (not Scala) project:

a) set mainLang to java because mainLang tricky autodetection mechanism was removed and default value is scala

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                    <mainLang>java</mainLang>
                </configuration>
            </plugin>

or

            <properties>
                ...
                <play.mainLang>java</play.mainLang>
            </properties>

1.0.0-alpha2 to 1.0.0-alpha3 migration

a) replace

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>

with

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>

b) replace

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
            </plugin>

with

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <dependencies>
                    <dependency>
                        <groupId>com.google.code.play2-maven-plugin</groupId>
                        <artifactId>play2-provider-play21</artifactId>
                        <version>${play2.plugin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

Play! 2.4.x to Play! 2.5.x migration

a) change Play! version from

    <properties>
        ...
        <play2.version>2.4.6</play2.version>
    </properties>

to

    <properties>
        ...
        <play2.version>2.5.0</play2.version>
    </properties>

b) if using Specs2 tests remove repository definition (all artifacts are in Maven central repository)

    <repositories>
        <repository>
            <id>scalaz-bintray</id>
            <name>Scalaz Bintray - releases</name>
            <url>https://dl.bintray.com/scalaz/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

c) add dependency

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-logback_2.11</artifactId>
            <version>${play2.version}</version>
            <scope>runtime</scope>
        </dependency>

d) default router generator type has changed from static to injected, add or remove configuration parameter

  • if static router generator is required add configuration parameter:
            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                    <routesGenerator>static</routesGenerator>
                </configuration>
            </plugin>

  • if injected is required, configuration parameter can be removed:
            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    ...
                    <!-- remove <routesGenerator>injected</routesGenerator> -->
                </configuration>
            </plugin>

Play! 2.3.x to Play! 2.4.x migration

a) change Play! version from

    <properties>
        ...
        <play2.version>2.3.10</play2.version>
    </properties>

to

    <properties>
        ...
        <play2.version>2.4.6</play2.version>
    </properties>

b) remove repository definition (all artifacts are in Maven central repository)

    <repositories>
        <repository>
            <id>typesafe</id>
            <name>Typesafe - releases</name>
            <url>http://repo.typesafe.com/typesafe/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

c) add dependency

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-netty-server_2.10</artifactId>
            <version>${play2.version}</version>
            <scope>runtime</scope>
        </dependency>

d) if enhancing classes, add dependency

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-enhancer</artifactId>
            <version>${play2-enhancer.version}</version>
        </dependency>

where play2-enhancer.version property needs to be added to project properties

    <properties>
        ...
        <play2-enhancer.version>1.1.0</play2-enhancer.version>
    </properties>

e) if using Specs2 tests add dependency

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-specs2_2.11</artifactId>
            <version>${play2.version}</version>
            <scope>test</scope>
        </dependency>

and repository definition

    <!-- 'com.typesafe.play:play-specs2_2.11' depends on
         'org.scalaz.stream:scalaz-stream_2.11:0.7a:jar'
         and this artifact is not available in Maven central repository yet,
         see https://github.com/scalaz/scalaz-stream/issues/258 -->
    <repositories>
        <repository>
            <id>scalaz-bintray</id>
            <name>Scalaz Bintray - releases</name>
            <url>https://dl.bintray.com/scalaz/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

f) if using JDBC evolutions add dependency

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-jdbc-evolutions_2.11</artifactId>
            <version>${play2.version}</version>
        </dependency>

g) if using Ebean change

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-java-ebean_2.11</artifactId>
            <version>${play2.version}</version>
        </dependency>

to

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-ebean_2.11</artifactId>
            <version>${play2-ebean.version}</version>
        </dependency>

where play2-ebean.version property needs to be added to project properties

    <properties>
        ...
        <play2-ebean.version>1.0.0</play2-ebean.version>
    </properties>

and change plugin’s configuration parameter from

                    <serverJvmArgs>-DapplyEvolutions.default=true</serverJvmArgs>

to

                    <serverJvmArgs>-Dplay.evolutions.db.default.autoApply=true</serverJvmArgs>

Play! 2.2.x to Play! 2.3.x migration

change Play! version from

    <properties>
        ...
        <play2.version>2.2.6</play2.version>
    </properties>

to

    <properties>
        ...
        <play2.version>2.3.10</play2.version>
    </properties>

Play! 2.1.x to Play! 2.2.x migration

a) change Play! version from

    <properties>
        ...
        <play2.version>2.1.5</play2.version>
    </properties>

to

    <properties>
        ...
        <play2.version>2.2.6</play2.version>
    </properties>

b) change groupId of all Play! dependencies from play

        <dependency>
            <groupId>play</groupId>
            <artifactId>play-xxxx_2.10</artifactId>
            <version>${play2.version}</version>
        </dependency>

to com.typesafe.play

        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-xxxx_2.10</artifactId>
            <version>${play2.version}</version>
        </dependency>