简体   繁体   English

使用Java 7支持设置Play Framework 2.3.x.

[英]Setting up Play Framework 2.3.x with Java 7 support

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. 我想设置一个在Java 7上运行的Play Framework应用程序。最新版本的Play Framework不支持Java 7.因此,通过查看更改日志,我发现2.3.10是我想要的。

Weirdly though, the activator links for every 2.3.x+ version points to the same place. 奇怪的是,每个2.3.x +版本的激活器链接指向同一个地方。 Also downloading and running them would set up Play Framework 2.4.3 without any kind of questions asked. 同时下载和运行它们将设置Play Framework 2.4.3而不会出现任何问题。

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. 如您所见,plugins.sbt文件说明了2.4.3并且在Java 7上构建失败。

Now, I have tried this by downloading 2.3.10 as well as 2.3.9 versions link. 现在,我通过下载2.3.10以及2.3.9版本链接尝试了这个。 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帖子解决这个问题(不幸的是我前一段时间尝试过,此时我没有耐心再次完成所有这些)这也给了一个全新的错误。

So my question is: How hard is it to actually setup a simple Play Framework application to run on Java 7? 所以我的问题是:实际设置一个简单的Play Framework应用程序在Java 7上运行有多难?

Activator does not determine the version of play as far as I understand. 据我所知,Activator并不确定游戏的版本。 It uses the information in files such as plugins.sbt to determine which version of play will be used for that particular app. 它使用plugins.sbt等文件中的信息来确定将为该特定应用程序使用哪个版本的播放。 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). plugins.sbt附带你正在下载的模板(种子应用程序),所以你需要一个2.3.x模板(例如尝试从激活模板页面手动下载一个),或者你需要“反向迁移”2.4您下载的应用程序(可能是相当耗时的练习,因为版本之间存在一些重要的变化)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM