在播放路线的文件中,如何指示使用模块中的路线?

In the Play Route's file, how can indicate to use routes from a module?

目前正在尝试学习 Manning 的 Play for Scala,特别是发布前测试模块的部分。

我创建了一个名为 "Ean2BarcodePlayModule" 的模块,组织为 "net.nowhereatall.playforscala"。

我已经使用激活器将本地发布到 ~/。ivy2/local

在我的测试项目中,我添加了库依赖项:

"net.nowhereatall.playforscala" %% "ean2barcodeplaymodule" % "1.0-SNAPSHOT"

现在,我想修改我的路由文件以指示

->      /barcode                    Ean2BarcodePlayModule.Routes

但这会导致:

 [error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes:10:
 not found: value Ean2BarcodePlayModule
[error] ->      /barcode                    Ean2BarcodePlayModule.Routes
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes: no
t found: value Ean2BarcodePlayModule
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes: va
lue setPrefix is not a member of Any
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes:10:
 not found: value Ean2BarcodePlayModule
[error] ->      /barcode                    Ean2BarcodePlayModule.Routes
[error] four errors found
[error] (compile:compile) Compilation failed
[error] Total time: 4 s, completed Mar 12, 2015 1:36:34 PM

或者,如果我尝试:

现在,我想修改我的路由文件以指示

->      /barcode                    net.nowhereatall.playforscala.Ean2BarcodePlayModule.Routes

结果是:

[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes:10:
 object nowhereatall is not a member of package net
[error] ->      /barcode                    net.nowhereatall.playforscala.Ean2Ba
rcodePlayModule.Routes
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes: ob
ject nowhereatall is not a member of package net
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes: va
lue setPrefix is not a member of Any
[error] D:\Tutorials\Workspaces\Scala\Ean2BarcodePlayModule-Test\conf\routes:10:
 object nowhereatall is not a member of package net
[error] ->      /barcode                    net.nowhereatall.playforscala.Ean2Ba
rcodePlayModule.Routes
[error] four errors found
[error] (compile:compile) Compilation failed
[error] Total time: 6 s, completed Mar 12, 2015 1:35:56 PM

正确的做法是什么?

感谢@Sarvesh Kumar Singh 将我引导至 "SubProjects" 上的页面,解决方案相对简单。

  1. 将模块源中的 "routes" 重命名为 "barcode.routes"。

  2. 重做激活器发布本地。

  3. 在 "Test" 项目路径文件中,将所需的行包含为

    ->/条形码barcode.Routes

(注意"Routes"中最后的"R"是大写,看来很重要!)