2

我是玩框架的新手,刚下载了Play 2.4.2,创建了一个项目使用

activator new

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

 activator eclipse

导致错误 在此处输入图像描述

我通过启动activator ui和通过激活器 Web 控制台将其转换为 Eclipse 项目,将项目转换为 Eclipse。但它在 UI 中也有,我看到了上面的错误信息,但它已经转换为 eclipse 项目。

将项目导入 Eclipse,它在 Application.java 文件中显示错误,如下所示。 在此处输入图像描述

我已经下载了Scala IDE,尝试导入项目,还是一样。我已经使用命令行启动了应用程序

activator run

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

启动不顺畅,如何解决?

4

2 回答 2

2

文档值得一读。它解释了将一些设置添加到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)中的现有项目导入。那么一切都应该很好。

于 2015-07-05T10:12:15.097 回答
0

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

于 2015-07-05T13:33:31.950 回答