gpt4 book ai didi

java - 无法编译 Java + Play! 'play eclipse' 上的框架项目

转载 作者:行者123 更新时间:2023-12-01 11:06:59 25 4
gpt4 key购买 nike

我正在尝试使用 Play Framework 2.2.3 创建一个新的 Java 应用程序,我运行 JDK 1.8.0_60。

运行 play new 确实可以工作并生成我想要的项目,但是当我尝试通过输入 play eclipse 将其设置为与 Eclipse Luna 一起使用时,它无法编译并写道:

[info] About to create Eclipse project files for your project(s).
[info] Compiling 4 Scala sources and 2 Java sources to D:\EclipseTest\FileUpload
\target\scala-2.10\classes...
[error] D:\EclipseTest\FileUpload\app\controllers\Application.java:3: error: pac
kage play does not exist
[error] import play.*;
[error] ^
[error] D:\EclipseTest\FileUpload\app\controllers\Application.java:4: error: pac
kage play.mvc does not exist
[error] import play.mvc.*;
[error] ^
[error] D:\EclipseTest\FileUpload\app\controllers\Application.java:8: error: can
not find symbol
[error] public class Application extends Controller {
[error] ^
[error] symbol: class Controller
[error] D:\EclipseTest\FileUpload\app\controllers\Application.java:10: error: ca
nnot find symbol
[error] public static Result index() {
[error] ^
[error] symbol: class Result
[error] location: class Application
[error] D:\EclipseTest\FileUpload\app\controllers\Application.java:11: error: ca
nnot access Html
[error] return ok(index.render("Your new application is ready."));
[error] ^
[error] class file for play.api.templates.Html not found
[error] 5 errors
[error] (compile:compile) javac returned nonzero exit code
[error] Could not create Eclipse project files:
[error] Error evaluating task 'dependencyClasspath': error

我尝试查找解决方案,但所有解决方案均引用 Scala。我看到一个修改了 build.sbt 的解决方案,说代码部分找不到它们依赖的库。我删除了 Seq 部分中找到的库,但没有帮助。

编辑:

这是我的 build.sbt 文件:

name := "FileUpload"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
)

play.Project.playJavaSettings

还有我的project/plugins.sbt:

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.3")

编辑2:

在上面的日志中,它表示缺少 play 库:play.*、play.mvc.* 和 play.api.templates.Html。这怎么可能呢?我刚刚创建了该项目。

最佳答案

问题是我的 Play 库文件的位置包含非英文字符或非数字字符,这是一个菜鸟错误...

关于java - 无法编译 Java + Play! 'play eclipse' 上的框架项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32847541/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com