Gant在编译升级的grails应用程序时抛出NullPointerException

时间:2012-12-25 00:44:18

标签: grails

我通过执行以下操作将Grails 1.3.7应用升级到Grails 2.2

  1. GRAILS_HOME变量设置为Grails 2.2的位置
  2. 编辑路径以引用此位置
  3. grails upgrade
  4. 编辑application.properties以删除所有插件引用
  5. 编辑Build.config以创建plugins封闭以引用我的插件
  6. grails clean
  7. grails compile
  8. 步骤7因以下错误而失败:

    C:\code\querium\AppServer-grails-2>grails compile --stacktrace
    | Compiling 98 source files
    | Warning The [executeSafely] action accepts a parameter of type [groovy.lang.Closure] which has not been marked with @V
    alidateable.  Data binding will still be applied to this command object but the instance will not be validateable.
    
           def executeSafely(Closure c) {
           ^
    | Warning The [executeSafely] action accepts a parameter of type [groovy.lang.Closure] which has not been marked with @V
    alidateable.  Data binding will still be applied to this command object but the instance will not be validateable.
    
            def executeSafely(Closure c) {
        ^
    | Warning The [increment] action accepts a parameter of type [java.util.Map] which has not been marked with @Validateabl
    e.  Data binding will still be applied to this command object but the instance will not be validateable.
    
            def increment(Map map, String t, int index) {
        ^
    | Compiling 98 source files.
    | Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (NOTE: Stack trace has be
    en filtered. Use --verbose to see entire trace.)
    java.lang.NullPointerException
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            at org.codehaus.gant.GantBuilder.invokeMethod(GantBuilder.java:99)
            at _GrailsCompile_groovy$_run_closure2_closure6_closure7.doCall(_GrailsCompile_groovy:48)
            at _GrailsCompile_groovy$_run_closure2_closure6_closure7.doCall(_GrailsCompile_groovy)
            at _GrailsCompile_groovy.withCompilationErrorHandling(_GrailsCompile_groovy:69)
            at _GrailsCompile_groovy.this$4$withCompilationErrorHandling(_GrailsCompile_groovy)
            at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
            at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:168)
            at _GrailsCompile_groovy$_run_closure2_closure6.doCall(_GrailsCompile_groovy:47)
            at _GrailsCompile_groovy$_run_closure2_closure6.doCall(_GrailsCompile_groovy)
            at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
            at _GrailsCompile_groovy$_run_closure2.doCall(_GrailsCompile_groovy:46)
            at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
            at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
            at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:1
    85)
            at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
            at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
            at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
            at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
            at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
            at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
            at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
            at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
            at gant.Gant.withBuildListeners(Gant.groovy:427)
            at gant.Gant.this$2$withBuildListeners(Gant.groovy)
            at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
            at gant.Gant.dispatch(Gant.groovy:415)
            at gant.Gant.this$2$dispatch(Gant.groovy)
            at gant.Gant.invokeMethod(Gant.groovy)
            at gant.Gant.executeTargets(Gant.groovy:591)
            at gant.Gant.executeTargets(Gant.groovy:590)
    | Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed
    

    我不确定真正的错误在哪里,以及如何纠正它。我很乐意忽略这些警告,除非有充分理由解决这些警告。 (如果是这样,怎么样?)

1 个答案:

答案 0 :(得分:2)

我不确定NPE,但警告是由控制器中的公共方法引起的。无法从应用程序代码中调用控制器,因此公共方法没有意义。在2.0以上的操作中,除了闭包之外,现在可以使用方法,因此您的帮助方法被误解为控制器操作。让它们变得私密,警告就会消失,而NPE也是如此。

docs btw中有升级信息:)