Grails 2.3.0升级问题与windows斜杠

Jus*_*lms 5 windows unicode grails upgrade backslash

在升级现有应用程序(最近升级,并使用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
Run Code Online (Sandbox Code Playgroud)

| 执行myApp-common插件升级脚本| 错误执行脚本升级错误:org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:解析期间的常规错误:未找到四位十六进制字符代码.line:1 col:20

groovyjarjarantlr.TokenStreamIOException:未找到四位十六进制字符代码.行:1个西:20在org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:723)在org.codehaus.groovy.antlr.parser.GroovyLexer $ 1.nextToken(GroovyLexer.java:258)在groovyjarjarantlr.TokenBuffer.fill(TokenBuffer.java:69)at groovyjarjarantlr.TokenBuffer.LA(TokenBuffer.java:80)at groovyjarjarantlr.LLkParser.LA(LLkParser.java:52)at 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 error (Use --stacktrace to see the full trace)

After some googling, it looked like this was related to a known issue with having \u in the code when not followed by a hex code. After removing all instances thereof, it still gave the same error. Next I changed the workspace where the code was at the time from C:\unique_workspace\Iteration21 to C:\x_unique_workspace\Iteration21 to remove the \u in the workspace address. Doing this and attempting the upgrade again resulted in this stacktrace:

| Environment set to development.....

    WARNING: This target will upgrade an older Grails application to 2.3.0.
    Are you sure you want to continue?
               [y,n] y
Run Code Online (Sandbox Code Playgroud)

| Executing myApp-common plugin upgrade script | Error Error executing script Upgrade: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^
Run Code Online (Sandbox Code Playgroud)

1 error (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^
Run Code Online (Sandbox Code Playgroud)

1 error

   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)
Run Code Online (Sandbox Code Playgroud)

| Error Error executing script Upgrade: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

Script1.groovy: 1: unexpected char: '\' @ line 1, column 20.
def pluginDir = 'C:\x_unique_workspace\Iteration21\myApp-common'
                   ^
Run Code Online (Sandbox Code Playgroud)

It appears that the upgrade script is choking on the '\' character while it updates the common plugin that the module requires, but I am having trouble discerning a way around it.

Wyt*_*tze 4

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

grails.project.work.dir = "target/work"
grails.project.plugins.dir = "${grails.project.work.dir}/plugins"
Run Code Online (Sandbox Code Playgroud)