3.7.11 插件依赖 - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith
Version: null
3.7.11 插件依赖
As of Grails 1.3 you can declaratively specify plugins as dependencies via the dependency DSL instead of using the install-plugin command:If you don't specify a group id the default plugin group id of
从Grails 1.3以来,你就可以通过依赖DSL的方式来声明插件的依赖了,而非只用install-plugin命令:grails.project.dependency.resolution = {
…
repositories {
…
} plugins {
runtime ':hibernate:1.2.1'
} dependencies {
…
}
…
}org.grails.plugins is used. You can specify to use the latest version of a particular plugin by using "latest.integration" as the version number:plugins {
runtime ':hibernate:latest.integration'
}grails.project.dependency.resolution = {
…
repositories {
…
} plugins {
runtime ':hibernate:1.2.1'
} dependencies {
…
}
…
}org.grails.plugins。你还可以将"latest.integration"作为版本号,这样就会自动获取最新的版本,例如:plugins {
runtime ':hibernate:latest.integration'
}Integration vs. Release
The "latest.integration" version label will also include resolving snapshot versions. To not include snapshot versions then use the "latest.release" label:plugins {
runtime ':hibernate:latest.release'
}The "latest.release" label only works with Maven compatible repositories. If you have a regular SVN-based Grails repository then you should use "latest.integration".And of course if you use a Maven repository with an alternative group id you can specify a group id:
plugins {
runtime 'mycompany:hibernate:latest.integration'
}集成(Integration)和正式(Release)版本
"latest.integration"的版本标签将会解析包含快照的版本,如果不想,可以使用"latest.release"标签:plugins {
runtime ':hibernate:latest.release'
}"latest.release"标签仅仅用于兼容Maven的存储库。如果你使用基于SVN的Grails存储库,你应该使用"latest.integration"。当然如果你使用非缺省组ID的Maven存储库,你可以为其指定一个:
plugins {
runtime 'mycompany:hibernate:latest.integration'
}Plugin Exclusions
You can control how plugins transitively resolves both plugin and JAR dependencies using exclusions. For example:plugins {
runtime(':weceem:0.8') {
excludes "searchable"
}
}excludes method you can tell Grails not to transitively install the searchable plugin. You can combine this technique to specify an alternative version of a plugin:plugins {
runtime(':weceem:0.8') {
excludes "searchable" // excludes most recent version
}
runtime ':searchable:0.5.4' // specifies a fixed searchable version
}plugins {
runtime(':weceem:0.8') {
transitive = false
}
runtime ':searchable:0.5.4' // specifies a fixed searchable version
}插件的排除
通过使用排除,你可以控制插件如何传递地解析JAR和插件的依赖,比如:plugins {
runtime(':weceem:0.8') {
excludes "searchable"
}
}excludes方法,你可以告诉Grails 不以 传递的方式安装searchable插件。你可以在此种方式的基础上,另外单独安装另一个版本的插件:plugins {
runtime(':weceem:0.8') {
excludes "searchable" // excludes most recent version
}
runtime ':searchable:0.5.4' // specifies a fixed searchable version
}plugins {
runtime(':weceem:0.8') {
transitive = false
}
runtime ':searchable:0.5.4' // specifies a fixed searchable version
}
