我应该如何声明和导出模块? [英] How should I be declaring and exporting modules?

查看:48
本文介绍了我应该如何声明和导出模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了securecrud模块,并且已经按照

I'm using the secure and crud modules with my app, and I've added them to application.conf as described in the tutorial. However, when I start my app, it generates a warning:

Declaring modules in application.conf is deprecated. Use dependencies.yml instead. (module.crud)

然后,这些模块在开发人员模式下可以工作,但是当我部署到服务器(使用play war等)时, 我明白了:

The modules then work while in dev mode, but when I deploy to my server (with play war etc), I get this:

13:55:40,662 WARN ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.crud)

13:55:40,662 ERROR ~ Module crud will not be loaded because /var/lib/apache-tomcat-6.0.32/webapps/pat/WEB-INF/modules/crud does not exist

那么,有两个问题:为什么我的模块没有导出,以及如何在dependencies.yml中声明它们?我查看了文档中的依赖项页面,我承认我真的不知道那里发生了什么.

So, two questions: why aren't my modules getting exported, and how do I declare them in dependencies.yml? I've looked at the dependency page in the docs, and I admit that I don't really get what's going on there.

谢谢!

推荐答案

在play 1.2+中设置模块的最简单方法是在创建应用时使用--with关键字.

The easiest way to set up modules in play 1.2+ is to use the --with keyword when you create your app.

例如

play new myapp --with crud,secure 

所生成的dependencies.yml的输出为

The output of the generated dependencies.yml is

# Application dependencies

require:
    - play
    - play -> secure
    - play -> crud

这篇关于我应该如何声明和导出模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆