play 2.3 子项目路由 "not a member" 报错
play 2.3 Subproject routing "not a member" Error
我在路由我的子项目时遇到问题,但我想我已按照所有步骤来包含我的子项目
|- mainProject
|- app
|- conf
|- modules
|- subProject
|- app
|- assets
|- controllers
|- subProject
|- Application.scala
|- Assets.scala
|- MyCode.java
|- models
|- subProject
|- MyModel.java
|- views
|- subProject
|- myView.scala.html
|- conf
|- subProject.routes
subProject.routes
GET / subProject.app.controllers.subProject.MyCode.index()
POST /add subProject.app.controllers.subProject.MyCode.add
POST /edit/:id subProject.app.controllers.subProject.MyCode.edit(id: Long)
GET /load/:id subProject.app.controllers.subProject.MyCode.load(id: Long)
GET /list subProject.app.controllers.subProject.MyCode.list()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file subProject.app.controllers.subProject.Assets.at(path="/public", file)
GET /webjars/*file controllers.WebJarAssets.at(file)
GET /javascriptRoutes subProject.app.controllers.subProject.Application.javascriptRoutes()
myview 包含此行:
<script src="@controllers.subProject.routes.Assets.at("javascripts/myJavascript.js")"></script>
我仍然收到错误
[error] /path/git/mainProject/module/subProject/app/views/subProject/myview.scala.html:8: object subProject is not a member of package controllers
[error] <script src="@controllers.subProject.routes.Assets.at("javascripts/myJavascript.js")"></script>
[error] ^
[error] one error found
[error] (subProject/compile:compile) Compilation failed
[error] Total time: 1 s, completed 07-Apr-2015 17:21:56
我认为我的路由文件是错误的,但如果我像文档中那样做的话
GET / controllers.subProject.myCode.index()
我明白了
[error] /path/git/mainProject/modules/subProject/conf/subProject.routes:6: object MyCode is not a member of package controllers.subProject
[error] GET / controllers.subProject.MyCode.index()
搜索 similar 问题没有帮助
我做错了什么?
编辑:我刚刚发现这个问题掩盖了反向路由的另一个问题
[error] /path/git/mainProject/modules/subProject/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:8: error: cannot find symbol
[error] public static final controllers.subProject.ReverseMyCode MyCode = new controllers.subProject.ReverseMyCode();
[error] ^
[error] symbol: class ReverseMyCode
[error] location: package controllers.subProject
[error] /path/git/mainProject/modules/subProjecy/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:11: error: package controllers.subProject.javascript does not exist
[error] public static final controllers.subProject.javascript.ReverseMyCode MyCode = new controllers.subProject.javascript.ReverseMyCode();
[error] ^
[error] /path/git/mainProject/modules/subProject/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:16: error: package controllers.subProject.ref does not exist
[error] public static final controllers.subProject.ref.ReverseMyCode MyCode = new controllers.subProject.ref.ReverseMyCode();
我遇到了同样的问题。我想 MyCode.java
的包是 modules.subProject.app.controllers.subProject.MyCode
?
那是因为你的 IDE 在包中创建了你的 类。
您的子项目的文件包必须以 controllers.subProject.
开头
并且您的 subProject.routes
文件必须是
GET / controllers.subProject.MyCode.index()
POST /add controllers.subProject.MyCode.add
POST /edit/:id controllers.subProject.MyCode.edit(id: Long)
GET /load/:id controllers.subProject.MyCode.load(id: Long)
GET /list controllers.subProject.MyCode.list()
对于反向路由错误,只需清理您的项目activator clean compile
我在路由我的子项目时遇到问题,但我想我已按照所有步骤来包含我的子项目
|- mainProject
|- app
|- conf
|- modules
|- subProject
|- app
|- assets
|- controllers
|- subProject
|- Application.scala
|- Assets.scala
|- MyCode.java
|- models
|- subProject
|- MyModel.java
|- views
|- subProject
|- myView.scala.html
|- conf
|- subProject.routes
subProject.routes
GET / subProject.app.controllers.subProject.MyCode.index()
POST /add subProject.app.controllers.subProject.MyCode.add
POST /edit/:id subProject.app.controllers.subProject.MyCode.edit(id: Long)
GET /load/:id subProject.app.controllers.subProject.MyCode.load(id: Long)
GET /list subProject.app.controllers.subProject.MyCode.list()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file subProject.app.controllers.subProject.Assets.at(path="/public", file)
GET /webjars/*file controllers.WebJarAssets.at(file)
GET /javascriptRoutes subProject.app.controllers.subProject.Application.javascriptRoutes()
myview 包含此行:
<script src="@controllers.subProject.routes.Assets.at("javascripts/myJavascript.js")"></script>
我仍然收到错误
[error] /path/git/mainProject/module/subProject/app/views/subProject/myview.scala.html:8: object subProject is not a member of package controllers
[error] <script src="@controllers.subProject.routes.Assets.at("javascripts/myJavascript.js")"></script>
[error] ^
[error] one error found
[error] (subProject/compile:compile) Compilation failed
[error] Total time: 1 s, completed 07-Apr-2015 17:21:56
我认为我的路由文件是错误的,但如果我像文档中那样做的话
GET / controllers.subProject.myCode.index()
我明白了
[error] /path/git/mainProject/modules/subProject/conf/subProject.routes:6: object MyCode is not a member of package controllers.subProject
[error] GET / controllers.subProject.MyCode.index()
搜索 similar 问题没有帮助
我做错了什么?
编辑:我刚刚发现这个问题掩盖了反向路由的另一个问题
[error] /path/git/mainProject/modules/subProject/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:8: error: cannot find symbol
[error] public static final controllers.subProject.ReverseMyCode MyCode = new controllers.subProject.ReverseMyCode();
[error] ^
[error] symbol: class ReverseMyCode
[error] location: package controllers.subProject
[error] /path/git/mainProject/modules/subProjecy/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:11: error: package controllers.subProject.javascript does not exist
[error] public static final controllers.subProject.javascript.ReverseMyCode MyCode = new controllers.subProject.javascript.ReverseMyCode();
[error] ^
[error] /path/git/mainProject/modules/subProject/target/scala-2.10/src_managed/main/controllers/subProject/routes.java:16: error: package controllers.subProject.ref does not exist
[error] public static final controllers.subProject.ref.ReverseMyCode MyCode = new controllers.subProject.ref.ReverseMyCode();
我遇到了同样的问题。我想 MyCode.java
的包是 modules.subProject.app.controllers.subProject.MyCode
?
那是因为你的 IDE 在包中创建了你的 类。
您的子项目的文件包必须以 controllers.subProject.
并且您的 subProject.routes
文件必须是
GET / controllers.subProject.MyCode.index()
POST /add controllers.subProject.MyCode.add
POST /edit/:id controllers.subProject.MyCode.edit(id: Long)
GET /load/:id controllers.subProject.MyCode.load(id: Long)
GET /list controllers.subProject.MyCode.list()
对于反向路由错误,只需清理您的项目activator clean compile