-
如果你先前使用的是Grails 1.0.3或以下的版本,那么下边用于从GRAILS_HOME导入脚本的语法将不再被支持:
Ant.property(environment:"env") grailsHome = Ant.antProject.properties."env.GRAILS_HOME" includeTargets << new File ( "${grailsHome}/scripts/Bootstrap.groovy" )
取而代之的是 grailsScript 方法,它能导入一个命名的脚本:includeTargets << grailsScript( "Bootstrap.groovy" )
2) 由于升级到了Gant,所有对变量 Ant 的引用应该改为 ant。 -
项目的根目录不再存于classpath中,像如下的资源加载方式将无法使用:
def stream = getClass().classLoader.getResourceAsStream("grails-app/conf/my-config.xml")
但是你可以使用Java文件API 以及 basedir 属性来完成如上操作:new File("${basedir}/grails-app/conf/my-config.xml").withInputStream { stream -> // read the file }