Grails内联插件:无法升级通过BuildConfig.groovy配置的插件 [英] Grails Inline Plugins: Cannot Upgrade a plugin that is configured via BuildConfig.groovy

查看:151
本文介绍了Grails内联插件:无法升级通过BuildConfig.groovy配置的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序分为主应用程序和少量插件。我们通过BuildConfig.groovy文件使用内联插件。现在是时候将所有东西都用于生产了,我收到以下消息:


您无法升级一个为$的插件b $ b通过BuildConfig.groovy配置,
删除配置继续。


然后Grails想要卸载插件因为它在application.properties中找不到它。但是在开发过程中,将它放在application.properties中会导致问题。因此,当我们准备创建一个生产WAR时,我们该如何解决这个问题,而无需每次都对BuildConfig.groovy中的插件进行评论?

解决方案

BuildConfig.groovy在运行过程中被读取得比较早,所以并不是所有的环境数据都可用。然而,它被解释为一个普通的groovy脚本,所以你可以尝试利用战争任务在生产环境中运行的事实:

  // BuildConfig.groovy 
if(System.getProperty(grails.env)==development){
//在这里通常指定inplace插件
}


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?

解决方案

BuildConfig.groovy is read rather early in the run process, so not all of environment data is yet available. However, it is interpreted as a regular groovy script, so you could try taking advantage of the fact that the war task is run in production environment:

// BuildConfig.groovy
if (System.getProperty("grails.env") == "development") {
     // specify the inplace plugin normally here
}

这篇关于Grails内联插件:无法升级通过BuildConfig.groovy配置的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆