Simplest project file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>test</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>play2</packaging> <name>Play! Framework 2.6.x Maven Test Project</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <play2.version>2.6.0-M1</play2.version> <scala.version>2.12.1</scala.version> </properties> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- default DI framework --> <!-- see https://www.playframework.com/documentation/2.6.x/Migration26#Guice-DI-support-moved-to-separate-module for more info --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-guice_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- default SLF4J logging implementation, can be replaced by other --> <!-- see https://www.playframework.com/documentation/2.6.x/SettingsLogger for more info --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-logback_2.12</artifactId> <version>${play2.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-netty-server_2.12</artifactId> <version>${play2.version}</version> <scope>runtime</scope> </dependency> </dependencies> <build> <sourceDirectory>${project.basedir}/app</sourceDirectory> <testSourceDirectory>${project.basedir}/test</testSourceDirectory> <resources> <resource> <directory>${project.basedir}/conf</directory> </resource> <resource> <directory>${project.basedir}/public</directory> <targetPath>public</targetPath> </resource> </resources> <plugins> <plugin> <groupId>com.google.code.play2-maven-plugin</groupId> <artifactId>play2-maven-plugin</artifactId> <version>1.0.0-beta6</version> <extensions>true</extensions> <configuration> <!-- if using controllers without dependency injection; default value is "injected" --> <routesGenerator>static</routesGenerator> </configuration> </plugin> <plugin> <groupId>com.google.code.sbt-compiler-maven-plugin</groupId> <artifactId>sbt-compiler-maven-plugin</artifactId> <version>1.0.0-rc1</version> </plugin> </plugins> </build> </project>
Example with optional dependencies and configuration options:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>test</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>play2</packaging> <name>Play! Framework 2.6.x Maven Test Project</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <anorm.version>2.6.0-M1</anorm.version> <play2.version>2.6.0-M1</play2.version> <play2-ebean.version>4.0.0-M1</play2-ebean.version> <play2-enhancer.version>1.1.0</play2-enhancer.version> <scala.version>2.12.1</scala.version> </properties> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- default DI framework --> <!-- see https://www.playframework.com/documentation/2.6.x/Migration26#Guice-DI-support-moved-to-separate-module for more info --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-guice_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using Anorm --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>anorm_2.12</artifactId> <version>${anorm.version}</version> </dependency> <!-- only if using JDBC --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-jdbc_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using JDBC evolutions --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-jdbc-evolutions_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using Java --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-java_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using Java forms --> <!-- previously part of 'play-java' module --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-java-forms_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using JSON --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-json_2.12</artifactId> <version>2.6.0-M3</version> </dependency> <!-- only if using Ebean --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-ebean_2.12</artifactId> <version>${play2-ebean.version}</version> </dependency> <!-- only if using JPA --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-java-jpa_2.12</artifactId> <version>${play2.version}</version> </dependency> <!-- only if using JPA --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.2.6.Final</version> <exclusions> <!-- required to avoid version downgrade from '1.4.01' to '1.0.b2' --> <exclusion> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> </exclusion> </exclusions> </dependency> <!-- default SLF4J logging implementation, can be replaced by other --> <!-- see https://www.playframework.com/documentation/2.6.x/SettingsLogger for more info --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-logback_2.12</artifactId> <version>${play2.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-netty-server_2.12</artifactId> <version>${play2.version}</version> <scope>runtime</scope> </dependency> <!-- only if enhancement is required --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-enhancer</artifactId> <version>${play2-enhancer.version}</version> </dependency> <!-- only if there are JUnit tests in the project --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-test_2.12</artifactId> <version>${play2.version}</version> <scope>test</scope> </dependency> <!-- only if there are Specs2 tests in the project --> <dependency> <groupId>com.typesafe.play</groupId> <artifactId>play-specs2_2.12</artifactId> <version>${play2.version}</version> <scope>test</scope> </dependency> <!-- only if there are ScalaTest tests in the project --> <dependency> <groupId>org.scalatestplus.play</groupId> <artifactId>scalatestplus-play_2.12</artifactId> <version>2.0.0-M2</version> <scope>test</scope> </dependency> </dependencies> <build> <sourceDirectory>${project.basedir}/app</sourceDirectory> <testSourceDirectory>${project.basedir}/test</testSourceDirectory> <resources> <resource> <directory>${project.basedir}/conf</directory> </resource> <resource> <directory>${project.basedir}/public</directory> <targetPath>public</targetPath> </resource> </resources> <plugins> <plugin> <groupId>com.google.code.play2-maven-plugin</groupId> <artifactId>play2-maven-plugin</artifactId> <version>1.0.0-beta6</version> <extensions>true</extensions> <configuration> <!-- if using controllers without dependency injection; default value is "injected" --> <routesGenerator>static</routesGenerator> <!-- only if using database evolutions --> <serverJvmArgs>-Dplay.evolutions.db.default.autoApply=true</serverJvmArgs> <!-- only if using 'play-java-forms' module --> <templateAdditionalImports>play.data._ play.core.j.PlayFormsMagicForJava._</templateAdditionalImports> </configuration> <executions> <!-- only if there are assets in the project --> <execution> <id>default-play2-compile-assets</id> <goals> <goal>closure-compile</goal> <!-- only if precompiling js assets --> <goal>coffee-compile</goal> <!-- only if precompiling coffee assets --> <goal>less-compile</goal> <!-- only if precompiling less assets --> </goals> </execution> <!-- only if enhancement is required --> <execution> <id>default-play2-enhance</id> <goals> <goal>enhance</goal> <goal>ebean-enhance</goal> <!-- only if using Ebean --> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.google.code.sbt-compiler-maven-plugin</groupId> <artifactId>sbt-compiler-maven-plugin</artifactId> <version>1.0.0-rc1</version> </plugin> </plugins> </build> </project>
WARNING: Play! Framework 2.6.x is not compatible with Scala 2.10.x
For more example projects go to Play! 2.6.x test projects.