Play 2 is generating a couple of classes (views, routes...) that your code is using such as routes and views. To make your IDE more happy, add target/scala-2.9.1/src_managed/main/ as a source folder. Be careful to not modify such sources, as they will be regenerated during the next compilation.
If you're using IDE's Maven support, you can use the build-helper-maven-plugin to add this source folder automatically:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>play2-add-managed-sources</id>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>
${project.build.directory}/scala-2.9.1/src_managed/main
</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
When PLAY2_HOME is using a homebrew play 2 installation, you get:
[INFO] --- play2-maven-plugin:1.2.0-SNAPSHOT:compile (default-compile) @ play2-authenticitytoken-sample ---
/usr/local/Cellar/play/2.0/libexec/play: line 51: /usr/local/Cellar/play/2.0/libexec//usr/local/Cellar/play/2.0/
libexec/../libexec/framework/build: No such file or directory
The problem comes from the homebrew installation of play using relative directories. The versions 1.2.0+ of the play2-maven-plugin manages this issue by using directly the play 2 executable from "/usr/local/bin/play"
For each play invocations, the plugin build an environment containing the Maven metadata such as:
So, to keep your version in sync, you need to edit your project/Build.scala file and add:
def fromEnv(name: String) = System.getenv(name) match {
case null => None
case value => Some(value)
}
val appName = fromEnv("project.artifactId").getOrElse("my-app")
val appVersion = fromEnv("project.version").getOrElse("1.0-SNAPSHOT")
// ...
Check this page for more information.