Play Framework Eclipse 项目转换报错

Play Framework Eclipse Project conversion error

我是play framework的新手,刚刚下载了Play 2.4.2,使用

创建了一个项目
activator new

之后,我尝试将项目转换为eclipse,但是命令

 activator eclipse

导致错误

我已通过启动 activator ui 并通过 Activator Web 控制台将其转换为 eclipse 项目,将项目转换为 eclipse。但是它在UI也一样,我看到了上面的错误信息,但是它已经转换为eclipse项目了。

将项目导入到 eclipse 中,它在 Application.java 文件中显示错误,如下所示。

我下载了Scala IDE,尝试导入项目,还是一样。 我已经使用

从命令行启动了应用程序
activator run

我的应用正在监听 9000,并刷新了 IDE 中的项目,但找不到符号仍未解决。

启动不流畅,如何解决?

这篇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)中导入现有项目。那么一切都应该是好的。

这里没问题。
Scala 模板必须先编译(在你启动项目并访问任何页面之后)然后eclipse 项目必须引用库(包含这些class)来解决错误。
尝试启动项目,访问页面并从激活器控制台重新生成 eclipse 项目并再次导入到 IDE。