As of Grails 1.3 you can declaratively specify dependencies on plugins rather than using the
install-plugin command:
plugins {
runtime ':hibernate:1.2.1'
}
If you don't specify a group id the default plugin group id of
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'
}
Integration vs. Release
The "latest.integration" version label will also include resolving snapshot versions. If you don't want to include snapshot versions then you can 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 are using a Maven repository with an alternative group id you can specify a group id:
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"
}
}
Here we have defined a dependency on the "weceem" plugin which transitively depends on the "searchable" plugin. By using the
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
}
You can also completely disable transitive plugin installs, in which case no transitive dependencies will be resolved:
plugins {
runtime( ':weceem:0.8' ) {
transitive = false
}
runtime ':searchable:0.5.4' // specifies a fixed searchable version
}