在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]
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]