Grails:环境内的配置项(BuildConfig.groovy)是否可以覆盖通用配置?

时间:2014-11-24 14:20:01

标签: grails grails-2.0 grails-plugin

在我的BuildConfig.groovy上,我有:

grails.plugin.location.plugin1 = "../plugin1"
grails.plugin.location.plugin2 = "../plugin2"

environments {
    qa2-bamboo {
        grails.plugin.location.plugin1 = "../AGP-CON-PLUG/plugin1"
        grails.plugin.location.plugin2 = "../AGP-CON-PLUG/plugin2"
    }
}

当我在qa2-bamboo时。是grails.plugin.location.plugin1 == "../AGP-CON-PLUG/plugin1"吗?

1 个答案:

答案 0 :(得分:1)

不,这不受支持,但可能应该是为了保持一致性。您可以访问当前环境值,因此可以使用if检查

来执行此操作
import grails.util.Environment

if (Environment.current == Environment.DEVELOPMENT || Environment.isDevelopmentMode()) {
   ...
}

或开关栏:

switch (Environment.current) {
   case Environment.DEVELOPMENT:
      ...
      break
   case ...
   default:
      ...
}