2015-09-29 87 views
3

我想設置在Java 7上運行的Play Framework應用程序。最新版本的Play Framework不支持Java 7.因此,通過查看change log,我找到了2.3.10是我想要的。設置支持Java 7的Play Framework 2.3.x

奇怪的是,每2.3.x +版本的激活器鏈接指向相同的地方。同時下載並運行它們將設置Play Framework 2.4.3,而不會提出任何問題。

下面是我的終端輸出:

[email protected]:~/Applications/activator-1.3.6-minimal$ cd 
[email protected]:~$ cd Applications 
[email protected]:~/Applications$ cd activator-1.3.6-minimal/ 
[email protected]:~/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 

[email protected]:~/Applications/activator-1.3.6-minimal$ cd play-java/ 
[email protected]:~/Applications/activator-1.3.6-minimal/play-java$ cd project/ 
[email protected]:~/Applications/activator-1.3.6-minimal/play-java/project$ ls 
build.properties plugins.sbt 
[email protected]:~/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文件說,對Java 7中

現在2.4.3和構建失敗,我已經試過這下載2.3.10以及2.3.9版本的鏈接。在這兩種情況下都產生了相同的結果。

因此,我試過this,但是這樣會產生不同的構建失敗錯誤。

/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上有多難?

+1

您可以嘗試2.2.x版本之一。他們不使用這個Activator。 – Kris

+1

是的。這可能會起作用。我真的很想知道爲什麼這不起作用。 – shyam

回答

0

就我所知,Activator並未確定播放的版本。它使用文件中的信息(如plugins.sbt)來確定哪個版本的遊戲將用於該特定應用程序。這就是爲什麼不同的版本鏈接指向相同的激活器。

plugins.sbt附帶您正在下載的模板(種子應用程序),因此您將需要2.3.x模板(例如,嘗試從activator templates page手動下載一個模板),或者您需要「反向遷移」2.4你已經下載的應用程序(可能相當耗時的練習,因爲版本之間有一些重要的變化)。