玩SBT子项目路线:shopping.routes:5:对象的应用是不包controllers.sh

2019-10-20 22:26发布

请给我一些建议。 我下面这个: https://www.playframework.com/documentation/2.2.x/SBTSubProjects

我做错了吗? 我有一个子项目路线错误:

shopping.routes:5: object Application is not a member of package controllers.shopping

我shopping.routes:

GET /index                  controllers.shopping.Application.index()
GET /assets/*file           controllers.shopping.Assets.at(path="/public", file)

我shopping.controllers.Application类:

package controllers.shopping

import play.api._
import play.api.mvc._
import views.html._

public Class Application extends Controller {

  public Result index() {
    return ok("shopping");
  }
}

我的主要build.sbt文件:

import play.Project._
name := "svp"


version := "2.0.0_(20140725)"

libraryDependencies ++= Seq(
  javaJdbc, 
  javaJpa, 
  "org.hibernate" % "hibernate-entitymanager" % "3.6.9.Final",
  "mysql" % "mysql-connector-java" % "5.1.27",
  "org.mindrot" % "jbcrypt" % "0.3m",
  cache
  )

playJavaSettings

lazy val shopping = project.in(file("modules/shopping"))

lazy val main = project.in(file(".")).dependsOn(shopping).aggregate(shopping)

Answer 1:

我已经错过了在结构上一个文件夹:文件夹“应用程序”,因此它应该是:/modules/shopping/app/controllers/Application.java

但我不得不代替它:/modules/shopping/controllers/Application.java

所以,我将结束:d



文章来源: Play sbt subProjects routes: shopping.routes:5: object Application is not a member of package controllers.shopping