How to set the Java Version for Compiling a Play Framework Module

Posted by Brian Porter on July 25, 2013

@jaliss and I were recently wondering how to make sure that a module was compiled with JSDK 1.6 after we had upgraded the Java Version on our Macbooks.

Stackoverflow user mgregori just provided this solution (Thanks!):

In the fileĀ project/Build.scala, add the setting below if you want to compile with java 1.6 :

val main = play.Project(appName, appVersion, appDependencies).settings(
  // Force compilation in java 1.6
  javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6")