5

在升级现有应用程序(最近升级并使用 Grails 2.2.4)时,我升级了应用程序的两个组件中使用的公共模块(称为 myApp-common)。这进展顺利,但是当我尝试升级第一个依赖模块时,我在运行“grails upgrade”命令时收到了附加的堆栈跟踪。

| 环境设置为开发......

    WARNING: This target will upgrade an older Grails application to 2.3.0.
    Are you sure you want to continue?
               [y,n] y

| 执行 myApp-common 插件升级脚本 | 错误执行脚本时出错升级:org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:解析期间出现一般错误:未找到四位十六进制字符代码。行:1 列:20

groovyjarjarantlr.TokenStreamIOException:找不到四位十六进制字符代码。行:1 col:20 at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:723) at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:258) at groovyjarjarantlr.TokenBuffer.fill(TokenBuffer.java:69) 在 groovyjarjarantlr.TokenBuffer.LA(TokenBuffer.java:80) 在 groovyjarjarantlr.LLkParser.LA(LLkParser.java:52) 在 org.codehaus.groovy.antlr.parser.GroovyRecognizer .nls(GroovyRecognizer.java:793) 在 org.codehaus.groovy.antlr.parser.GroovyRecognizer.varInitializer(GroovyRecognizer.java:2681) 在 org.codehaus.groovy.antlr.parser.GroovyRecognizer.variableDeclarator(GroovyRecognizer.java:7928) ) 在 org.codehaus.groovy.antlr.parser.GroovyRecognizer。

1 个错误(使用 --stacktrace 查看完整跟踪)

经过一番谷歌搜索,看起来这与一个已知问题有关,即在代码中包含 \u 时没有后跟十六进制代码。删除所有实例后,它仍然给出了相同的错误。接下来,我将代码当时所在的工作区从 C:\unique_workspace\Iteration21 更改为 C:\x_unique_workspace\Iteration21 以删除工作区地址中的 \u。这样做并再次尝试升级会导致此堆栈跟踪:

| 环境设置为开发......

    WARNING: This target will upgrade an older Grails application to 2.3.0.
    Are you sure you want to continue?
               [y,n] y

| 执行 myApp-common 插件升级脚本 | 错误执行脚本升级错误:org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^

1 个错误(注意:堆栈跟踪已被过滤。使用 --verbose 查看整个跟踪。) org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^

1 个错误

   at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:72)
    at Upgrade$_run_closure1.doCall(Upgrade.groovy:229)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    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 org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at Upgrade$_run_closure2.doCall(Upgrade.groovy:239)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    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)

| 错误执行脚本升级错误:org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^

升级脚本似乎在更新模块所需的通用插件时阻塞了“\”字符,但我无法辨别出解决方法。

4

3 回答 3

4

尝试执行升级(spring-security-core 插件)时我遇到了同样的问题。我在 BuildConfig.groovy 中添加了以下属性来修复它:

grails.project.work.dir = "target/work"
grails.project.plugins.dir = "${grails.project.work.dir}/plugins"
于 2013-10-27T12:52:44.707 回答
1

命令有问题upgradegrails upgrade而不是手动运行更改app.grails.version=2.3.x项目目录中 application.properties 文件中的行。

查看JIRA 问题

于 2013-12-05T12:55:20.820 回答
1

这是由于/scripts/_upgrade.groovy. 它有 // 或 commonented 行,因此您可以尝试删除此文件。

于 2014-03-31T17:22:45.167 回答