这是我的情况。我有一个使用 guice module 的 Play 应用程序.为了使用 guice 模块:
play install guice
安装它.这会将其安装在 $PLAY_HOME/modules
这对我来说很好。我不想以任何方式编辑模块文件。 dependencies.yml
中声明了该模块像这样:- play -> guice 1.2
play dependencies
,这很好地解析了模块并创建了 modules/guice-1.2
引用 guice 模块的文件。 问题是该文件的内容类似于以下内容:
/some-absolute-path/play-1.2.x/modules/guice-1.2
.在本地工作以进行开发时,这很好用。但是当我想移动到生产服务器时,安装不同的 Play! (即使用不同的绝对路径)它显然会失败。
那么处理这个问题的最佳方法是什么?
现在我已经诉诸于在
application.conf
中声明模块。像这样的文件:module.guice=${play.path}/modules/guice-1.2
.不幸的是
${play.path}
魔术似乎不适用于那些生成的文件。顺便说一句,我使用的是 1.2.3 版的 Play!
最佳答案
您应该尝试在您的 dependencies.yml 文件中使用 ${application.path},就像在这个例子中一样
require:
- play -> crud
- provided -> DateHelper 1.0
repositories:
- provided:
type: local
artifact: "${application.path}/jar/[module]-[revision].jar"
contains:
- provided -> *
看到这个问题:How can I specify a local jar file as a dependency in Play! Framework 1.x
关于module - 如何在不引用绝对路径的情况下引用 Play Framework 第三方模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7282682/