6

Our app is split into a main application and a few plugins. We're using inline plugins via the BuildConfig.groovy file. When it is time to WAR the whole thing up for production I'm getting the following message:

You cannot upgrade a plugin that is configured via BuildConfig.groovy, remove the configuration to continue.

And then Grails wants to uninstall the plugin because it can't find it in application.properties. But during development, having it in application.properties causes issues. So when we're ready to create a production WAR, how do we work around this without commenting the plugins in BuildConfig.groovy every time?

4

1 回答 1

2

BuildConfig.groovy 是在运行过程的早期读取的,因此并非所有环境数据都可用。但是,它被解释为常规的 groovy 脚本,因此您可以尝试利用 war 任务在生产环境中运行的事实:

// BuildConfig.groovy
if (System.getProperty("grails.env") == "development") {
     // specify the inplace plugin normally here
}
于 2011-08-30T13:26:05.420 回答