Grails中引入依赖包/框架/插件

在Grails项目中,引入第三方包/框架(准确的说是G没有内置的第三方)有3个办法

1. 在[b]plugin[/b]库里,选择可用的插件,比如ckeditor,好处是可以自动完成一些配置工作,使用起来很便捷。但要深入使用还需要了解框架的具体知识。

[color=blue]用过的plugin
1) ckeditor:富文本编辑器
2) excel-import:处理excel文件
3) joda-time:excel-import依赖之[/color]

2. 编辑[b]BuildConfig.groovy[/b]文件
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.

[color=red] runtime 'mysql:mysql-connector-java:5.1.22'[/color]
}

只需一条语句,自动下载、自动配置
[img]http://dl.iteye.com/upload/attachment/0079/5782/cdbe48c0-a56e-3216-8570-d3bd4fa79617.png[/img]

注:在USER_HOME/.grails下,按照Grails版本以及项目名称进行划分,在每个工程目录中保存着工 程的元数据以及其使用的插件类、文件以及资源。

[quote]Grails features five dependency resolution configurations (or 'scopes'):
•build: Dependencies for the build system only
•compile: Dependencies for the compile step
•runtime: Dependencies needed at runtime but not for compilation (see above)
•test: Dependencies needed for testing but not at runtime (see above)
•provided: Dependencies needed at development time, but not during WAR deployment

[/quote]


3. 传统方式,在IDE里加入依赖方式

[img]http://dl.iteye.com/upload/attachment/0079/5784/bb2e0868-8596-3a79-9bd9-437e23fdd9f9.png[/img]
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值