2015-07-05 36 views
2

我玩框架一個新手,剛下載的播放2.4.2,創建使用播放框架Eclipse項目轉換錯誤

activator new 

之後,一個項目,我試圖轉換項目,偏食,但命令

activator eclipse 

導致錯誤 enter image description here

我已經開始把它轉換到Eclipse項目並通過激活器Web控制檯,將項目轉換爲eclipse。但它也在UI中,我看到了上述錯誤信息,但它已轉換爲eclipse項目。

將項目導入到eclipse中,它在Application.java文件中顯示錯誤,如下所示。 enter image description here

我已經下載了Scala IDE,試圖導入項目,仍然是一樣的。 我已經開始從命令行中使用

activator run 

我的應用程序是在9000監聽的應用程序,並在IDE刷新項目,仍無法找到符號是沒有得到解決。

跳躍開始不順利,如何解決這個問題?

+0

您必須在項目文件夾中啓動激活器,該文件夾是您項目的'build.sbt'。轉到這個文件夾,輸入'activator clean',然後輸入'activator eclipse'(或者Intellij Idea的'activator idea'),你的錯誤應該會消失。 – Kris

+0

在project \ plugins.sbt文件中添加了以下行 // Eclipse插件 addSbtPlugin(「com.typesafe.sbteclipse」%「sbteclipse-plugin」%「4.0.0」) – srk

回答

2

這個documentation值得一讀。它解釋了加入一些設置在build.sbt

$ activator new eclipse 

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 
OK, application "eclipse" is being created using the "play-java" template. 

To run "eclipse" from the command line, "cd eclipse" then: 
/Users/ben/projects/eclipse/activator run 

To run the test for "eclipse" from the command line, "cd eclipse" then: 
/Users/ben/projects/eclipse/activator test 

To run the Activator UI for "eclipse" from the command line, "cd eclipse" then: 
/Users/ben/projects/eclipse/activator ui 

$ cd eclipse/ 
$ echo 'addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")' >> project/plugins.sbt 
$ ./activator compile 
... 
[info] downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbteclipse/sbteclipse-plugin/scala_2.10/sbt_0.13/4.0.0/jars/sbteclipse-plugin.jar ... 
[info] [SUCCESSFUL ] com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0!sbteclipse-plugin.jar (2998ms) 
... 
[info] Compiling 6 Scala sources and 2 Java sources to /Users/ben/projects/eclipse/target/scala-2.11/classes... 
[success] Total time: 36 s, completed 05-Jul-2015 14:00:25 
$ ./activator eclipse 
[info] Loading project definition from /Users/ben/projects/eclipse/project 
[info] Set current project to eclipse (in build file:/Users/ben/projects/eclipse/) 
[info] About to create Eclipse project files for your project(s). 
[info] Successfully created Eclipse project files for project(s): 
[info] eclipse 
$ 

然後導入爲內ScalaIDE(您的Eclipse)現有項目。那麼一切都應該是好的。

+0

我已將行添加到build.sbt如上所述,但是當我在CLI中說激活器時,它拋出了以下錯誤: EclipseKeys.preTasks:= Seq(在編譯時編譯) ^ [error]表達式中的類型錯誤 項目加載失敗。 – srk

+0

我已經加入了演練,我懷疑你使用的是Windows,在這種情況下,除了使用「echo」行之外,你可以使用文本編輯器添加SBT Eclipse插件行。 – bjfletcher

0

這裏沒問題。
必須先編譯Scala模板(在啓動項目並訪問任何頁面後),然後eclipse項目必須參考庫(包含這些類)來解決錯誤。
嘗試啓動項目,訪問頁面並從激活控制檯重新生成eclipse項目並再次導入到IDE。