Play框架 - 新项目中不存在包

时间:2014-08-24 15:33:18

标签: java playframework playframework-2.3

我正在尝试编译新创建的Play Framework应用程序。我按照说明并使用play-java模板生成应用程序并将其命名为test。我导航到'测试'目录,再次运行activator.bat并输入' compile'。这显示:

Z:\aaa\activator-1.2.10\test>activator.bat
[info] Loading project definition from Z:\aaa\activator-1.2.10\test\project
[info] Set current project to test (in build file:/Z:/aaa/activator-1.2.10/test/)
[test] $ compile
[info] Compiling 4 Scala sources and 2 Java sources to Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes...
[error] Z:\aaa\activator-1.2.10\test\app\controllers\Application.java:3: error: package play does not exist
[error] import play.*;
[error] ^
[error] Z:\aaa\activator-1.2.10\test\app\controllers\Application.java:4: error: package play.mvc does not exist
[error] import play.mvc.*;
[error] ^
[error] Z:\aaa\activator-1.2.10\test\app\controllers\Application.java:8: error: cannot find symbol
[error] public class Application extends Controller {
[error]                                  ^
[error]   symbol: class Controller
[error] Z:\aaa\activator-1.2.10\test\app\controllers\Application.java:10: error: cannot find symbol
[error]     public static Result index() {
[error]                   ^
[error]   symbol:   class Result
[error]   location: class Application
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaS
ignature': class file for scala.reflect.ScalaSignature not found
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\ReverseApplication.class: warning: Cannot find annotation method 'bytes()' in type 'S
calaSignature'
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\javascript\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in t
ype 'ScalaSignature'
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\javascript\ReverseApplication.class: warning: Cannot find annotation method 'bytes()'
 in type 'ScalaSignature'
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\ref\ReverseAssets.class: warning: Cannot find annotation method 'bytes()' in type 'Sc
alaSignature'
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\controllers\ref\ReverseApplication.class: warning: Cannot find annotation method 'bytes()' in typ
e 'ScalaSignature'
[error] Z:\aaa\activator-1.2.10\test\target\scala-2.11\classes\views\html\index.class: warning: Cannot find annotation method 'bytes()' in type 'ScalaSignature'

[error] Z:\aaa\activator-1.2.10\test\app\controllers\Application.java:11: error: cannot access Html
[error]         return ok(index.render("Your new application is ready."));
[error]                  ^
[error]   class file for play.twirl.api.Html not found
[error] 5 errors
[error] 7 warnings
[error] (compile:compile) javac returned nonzero exit code
[error] Total time: 7 s, completed 2014-08-24 17:29:48

我正在使用Windows 8.提前感谢。

编辑:我设法运行2.2没有任何问题,只有2.3没有看到播放。*

1 个答案:

答案 0 :(得分:1)

您不必转到子目录。

Activator或SBT应该从build.sbt文件的目录运行(该目录是包含apptest子目录的父目录。

一旦Activator / SBT启动,就可以使用任务test编译和执行测试。