【问题标题】:Grails error executing create-appGrails 执行创建应用程序时出错
【发布时间】:2010-09-01 14:54:59
【问题描述】:

我正在使用 jdk1.6 和 grails 1.3.4。我已经按照 grails.org 站点中的说明设置了 JAVA_HOME、GRAILS_HOME 和 PATH 变量。当我执行 create-app 命令时,出现以下错误:

C:\grails\grails-1.3.4>grails create-app C:\Users\Documents\Grails\helloworld 欢迎使用 Grails 1.3.4 - http://grails.org/ 根据 Apache 标准许可证 2.0 获得许可 Grails home 设置为:C:\grails\grails-1.3.4

Base Directory: C:\grails\grails-1.3.4
Resolving dependencies...
Dependencies resolved in 2102ms.
Running script C:\grails\grails-1.3.4\scripts\CreateApp_.groovy
Environment set to development
Error executing script CreateApp: java.lang.StringIndexOutOfBoundsException: Str
ing index out of range: 1
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
        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:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range:
 1
        at java.lang.String.substring(String.java:1934)
        at grails.util.GrailsNameUtils.getClassNameRepresentation(GrailsNameUtil
s.java:82)
        at grails.util.GrailsNameUtils$getClassNameRepresentation.call(Unknown S
ource)
        at _GrailsCreateProject_groovy$_run_closure4.doCall(_GrailsCreateProject
_groovy:135)
        at _GrailsCreateProject_groovy$_run_closure1.doCall(_GrailsCreateProject
_groovy:36)
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
        ... 10 more
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
        at java.lang.String.substring(String.java:1934)
        at grails.util.GrailsNameUtils.getClassNameRepresentation(GrailsNameUtil
s.java:82)
        at grails.util.GrailsNameUtils$getClassNameRepresentation.call(Unknown S
ource)
        at _GrailsCreateProject_groovy$_run_closure4.doCall(_GrailsCreateProject
_groovy:135)
        at _GrailsCreateProject_groovy$_run_closure1.doCall(_GrailsCreateProject
_groovy:36)
        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:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
Error executing script CreateApp: java.lang.StringIndexOutOfBoundsException: Str
ing index out of range: 1

存在 StringIndexOutOfBoundsException。谁能帮我解决这个问题?

谢谢

SJan

【问题讨论】:

  • 这是一个错误——在最新版本的 Grails 中,如果您未指定应用程序名称,脚本将提示您输入它。

标签: grails


【解决方案1】:

create-app: Grails 的起点。此命令创建一个 Grails 应用程序并要求用户指定应用程序名称。然后根据输入的应用程序名称在执行命令的目录中创建一个子目录。

执行此命令的正确方法:

  • 使用命令提示符浏览到您的工作区目录
  • 输入“grails create-app helloworld”
  • 将创建一个子目录“helloworld”作为您的工作区目录

【讨论】:

    猜你喜欢
    • 2012-01-17
    • 2020-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 2012-01-29
    • 2018-09-23
    • 2023-04-07
    相关资源
    最近更新 更多