Play Framework For Scala:[类型 BooksController 不是包控制器的成员]

Play Framework For Scala: [type BooksController is not a member of package controllers]

我尝试编译,但在控制台上出现以下编译错误

<>@7a6b9ggi8 - 内部服务器错误,对于 (GET) [/books] ->

 play.sbt.PlayExceptions$CompilationException: Compilation error[type BooksController is not a member of package controllers]
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
    at scala.Option.map(Option.scala:145)
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:49)
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44)
    at scala.Option.map(Option.scala:145)
    at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44)
    at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40)
    at play.sbt.run.PlayReload$$anonfun$compile.apply(PlayReload.scala:17)
    at play.sbt.run.PlayReload$$anonfun$compile.apply(PlayReload.scala:17)
 [info] Compiling 4 Scala sources and 1 Java source to /Users/Play/PROJ_NAME/target/scala-2.11/classes...
 [error] /Users/Play/PROJ_NAME/conf/routes:18: type BooksController is not a member of package 

controllers
[error] GET     /books                      controllers.BooksController.index()
[error] /Users/Play/PROJ_NAME/conf/routes:18: type BooksController is not a member of package controllers
[error] GET     /books                      controllers.BooksController.index()
[error] /Users/Play/PROJ_NAME/conf/routes:18: type BooksController is not a member of package controllers
[error] GET     /books                      controllers.BooksController.index()
[error] three errors found
[error] (compile:compileIncremental) Compilation failed
[error] application -

而 BooksController 是

package controllers;

import play.mvc.Controller;
import play.mvc.Result;

import play.*;
import play.data.*;
import play.mvc.*;
import views.html.*;
//
public class BooksController extends Controller{
    public Result index(){
        return TODO;
    }
}

路线是

GET     /                           controllers.HomeController.index
# An example controller showing how to use dependency injection
GET     /count                      controllers.CountController.count
# An example controller showing how to write asynchronous code
GET     /message                    controllers.AsyncController.message
# Map static resources from the /public folder to the /assets URL path
GET     /assets/*file               controllers.Assets.versioned(path="/public", file: Asset)

#フォーム処理アクション
#POST   /send                       controllers.HomeController.send()

#book用
GET     /books                      controllers.BooksController.index()
#GET     /books/create               controllers.BooksController.create()
#GET     /books/:id                  controllers.BooksController.show(id: Integer)
#GET     /books/edit/:id             controllers.BooksController.edit(id: Integer)
#POST    /books/edit                 controllers.BooksController.update()
#POST    /books/create               controllers.BooksController.save()
#GET     /books/delete/:id           controllers.BooksController.destroy(id: Integer)

GET     /about/

我正在使用 Play Framework 2.5.10 如何调试这个编译错误?

感谢您的支持!

这可能是因为您的控制器是 java-class 而不是 scala-class。我知道我自己犯了一个错误,把它搞混了。

我在想特别是因为你得到这个:Compiling 4 Scala sources and 1 Java source 并且可能包不正确。也许它应该 /app/controllers 或许让您更容易签入您的 ide.