简体   繁体   中英

Can't Compile a Java + Play! Framework Project upon 'play eclipse'

I'm trying to create a fresh Java application using Play Framework 2.2.3, I run JDK 1.8.0_60.

Running play new does work and generates the project I want, however when I try to set it to work with Eclipse Luna by typing play eclipse it fails to compile and writes this:

[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

I tried looking up the solution but all solutions refer to Scala. I saw a solution which modified the build.sbt , saying the code parts couldn't find the libraries they depend on. I removed the libraries found in the Seq section, but it was unhelpful.

EDIT:

Here's my build.sbt file:

name := "FileUpload"

version := "1.0-SNAPSHOT"

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

play.Project.playJavaSettings

And my 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")

EDIT 2:

In the log above it says that the play libraries are missing: play.*, play.mvc.* & play.api.templates.Html . How could this be though? I only just created the project.

问题是我的Play库文件的位置字符不是英语也不是数字,这是一个菜鸟错误。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM