在Grails 2中,我们使用内部库来动态设置Config.groovy文件中的属性值。该库查看特定于环境的配置管理数据库并填充这些值。这是在Grails的2Grails3 application.groovy动态属性
import com.mycompany.otherproject.ConfigurationManagement
family {
dynamic.property = ConfigurationManagement.getValue("dynamic.property.name", "default")
static.proprty = "static value"
}
基础上Upgrading from Grails 2.x - Reference Documentation工作的配置的一个例子,我复制此信息application.groovy,但现在我碰到下面的错误,我一直未能解决。
Error |
Error occurred running Grails CLI: startup failed:
script14930638938641309394273.groovy: 1: unable to resolve class com.mycompany.otherproject.ConfigurationManagement
@ line 1, column 1.
import com.mycompany.otherproject.ConfigurationManagement
^
建议?
您是否尝试不导入类,而是调用'com.mycompany.otherproject.ConfigurationManagement'或它的实例中的方法?你确定类是存在于你的类路径中吗? –
我正在使用IntelliJ Idea,如果我使用导入,那么我可以跳转到方法定义。如果我删除导入,那么我不能再这样做,并且构建会给我一个不同的错误:运行Grails CLI时发生错误:没有方法签名:groovy.util.ConfigObject.getValue()适用于参数类型:(java .lang.String,java.lang.String) – GeoGriffin
也许我没有运行这个权利。我从我的运行配置中执行“grails clean”,就像我在Grails 2中所做的那样,但我不认为这是正确的。我较早前完成了这个任务,并且完成了构建步骤,但是我只是为“gradle clean”和“gradle build”设置了一个新的运行配置,现在我得到了与某些单元测试有关的不同错误以及我需要的其他重构。 – GeoGriffin