您是在BuildConfig.groovy
文件中指定插件还是使用install-plugin
命令“安装”插件?我的阅读表明install-plugin
不再推荐使用该命令,您应该在BuildConfig.groovy
文件中指定插件,然后 Grails 将处理它,无论您部署在什么机器上。
例子:
plugins {
/*
* build - dependency that is only needed by the build process
* compile - dependency that is needed at both compile-time and runtime. This is the most common case
* provided - dependency that is needed at compile-time but should not be packaged with the app (usually because it is provided by the container). An example is the Servlet API
* runtime - dependency that is needed to run the application, but not compile it e.g. JDBC implementation for specific database vendor. This would not typically be needed at compile-time because code depends only the JDBC API, rather than a specific implementation thereof
* test - dependency that is only needed by the tests
*/
runtime ":cached-resources:1.0"
runtime ":database-migration:1.1"
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":resources:1.1.6"
runtime ":yui-minify-resources:0.1.4"
runtime ":zipped-resources:1.0"
compile ":cache-headers:1.1.5"
compile ":commentable:0.8.1"
compile ":jquery-ui:1.8.15"
compile ":joda-time:1.4"
compile ":searchable:0.6.3"
compile ":spring-security-ldap:1.0.6" // Also installs spring-security-core
build ":tomcat:$grailsVersion"
}
另请注意,某些插件还需要在文件dependencies
部分中的特殊条目BuildConfig.groovy
。该JodaTime
插件就是这样一个插件。
dependencies {
compile "org.jadira.usertype:usertype.jodatime:1.9"
}
插件的文档应指定是否dependencies
需要该部分中的任何条目。