繁体   English   中英

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

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

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

奇怪的是,每个2.3.x +版本的激活器链接指向同一个地方。 同时下载和运行它们将设置Play Framework 2.4.3而不会出现任何问题。

下面是我的终端输出:

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")

如您所见,plugins.sbt文件说明了2.4.3并且在Java 7上构建失败。

现在,我通过下载2.3.10以及2.3.9版本链接尝试了这个。 在这两种情况下都产生了相同的结果。

因此,我尝试了这一点,但这导致了完全不同的构建失败错误。

/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

我尝试用另一个SO帖子解决这个问题(不幸的是我前一段时间尝试过,此时我没有耐心再次完成所有这些)这也给了一个全新的错误。

所以我的问题是:实际设置一个简单的Play Framework应用程序在Java 7上运行有多难?

据我所知,Activator并不确定游戏的版本。 它使用plugins.sbt等文件中的信息来确定将为该特定应用程序使用哪个版本的播放。 这就是为什么不同的版本链接指向同一个激活器。

plugins.sbt附带你正在下载的模板(种子应用程序),所以你需要一个2.3.x模板(例如尝试从激活模板页面手动下载一个),或者你需要“反向迁移”2.4您下载的应用程序(可能是相当耗时的练习,因为版本之间存在一些重要的变化)。

暂无
暂无

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

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