3

I want to setup a Play Framework application which runs on Java 7. The latest versions of Play Framework does not support Java 7. So by looking at the change log I figured out 2.3.10 is the one I want.

Weirdly though, the activator links for every 2.3.x+ version points to the same place. Also downloading and running them would set up Play Framework 2.4.3 without any kind of questions asked.

Below is the my terminal output:

shyam@shyam-work:~/Applications/activator-1.3.6-minimal$ cd
shyam@shyam-work:~$ cd Applications
shyam@shyam-work:~/Applications$ cd activator-1.3.6-minimal/
shyam@shyam-work:~/Applications/activator-1.3.6-minimal$ ./activator new

Fetching the latest list of templates...

Browse the list of templates: http://typesafe.com/activator/templates
Choose from these featured templates or enter a template name:
  1) minimal-akka-java-seed
  2) minimal-akka-scala-seed
  3) minimal-java
  4) minimal-scala
  5) play-java
  6) play-scala
(hit tab to see a list of all templates)
> 5
Enter a name for your application (just press enter for 'play-java')
> play-java
OK, application "play-java" is being created using the "play-java" template.

To run "play-java" from the command line, "cd play-java" then:
/home/shyam/Applications/activator-1.3.6-minimal/play-java/activator run

To run the test for "play-java" from the command line, "cd play-java" then:
/home/shyam/Applications/activator-1.3.6-minimal/play-java/activator test

To run the Activator UI for "play-java" from the command line, "cd play-java" then:
/home/shyam/Applications/activator-1.3.6-minimal/plpay-java/activator ui

shyam@shyam-work:~/Applications/activator-1.3.6-minimal$ cd play-java/
shyam@shyam-work:~/Applications/activator-1.3.6-minimal/play-java$ cd project/
shyam@shyam-work:~/Applications/activator-1.3.6-minimal/play-java/project$ ls
build.properties  plugins.sbt
shyam@shyam-work:~/Applications/activator-1.3.6-minimal/play-java/project$ nano plugins.sbt

  GNU nano 2.2.6          File: plugins.sbt                            

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")

// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")

// Play enhancer - this automatically generates getters/setters for pu$
// and rewrites accessors of these fields to use the getters/setters. $
// plugin if you prefer not to have this feature, or disable on a per $
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

// Play Ebean support, to enable, uncomment this line, and enable in y$
// enablePlugins(SbtEbean). Note, uncommenting this line will automati$
// Play enhancer, regardless of whether the line above is commented ou$
// addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

As you can see, the plugins.sbt file says 2.4.3 and build fails on Java 7.

Now, I have tried this by downloading 2.3.10 as well as 2.3.9 versions link. In both case the same results were produced.

Consequently, I tried this but that gave rise to a different build fail error altogether.

/home/shyam/Applications/activator-1.3.6-minimal/play-java/build.sbt:17: error: not found: value routesGenerator
routesGenerator := InjectedRoutesGenerator
^
[error] Type error in expression

I tried fixing this with another SO post(unfortunately I tried it some time ago and at this point I don't have the patience to go through all this again) which too gave an entirely new error.

So my question is: How hard is it to actually setup a simple Play Framework application to run on Java 7?

Community
  • 1
  • 1
shyam
  • 1,201
  • 3
  • 20
  • 37

1 Answers1

0

Activator does not determine the version of play as far as I understand. It uses the information in files such as plugins.sbt to determine which version of play will be used for that particular app. That is why the different version links point to the same activator.

plugins.sbt comes with the template (seed app) you are downloading, so you will either need a 2.3.x template (try downloading one manually from the activator templates page for example), or you will need to "reverse migrate" the 2.4 app that you have downloaded (probably quite a time consuming exercise, as there are some important changes between the versions).

wwkudu
  • 2,608
  • 3
  • 24
  • 36