本文介绍了Grails 1.4.0.M1(带STS 2.7.0.M2)GantBuilder的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到...


  • Grails 1.4.0.M1

  • Groovy 1.8.0

  • STS版本:2.7.0.M2 Build Id:201106101000 - 适用于Mac的64位Cocoa版本

  • 我有OS X 10.5。 8。使用JVM 1.5.0

  • Grails 1.4.0.M1
  • Groovy 1.8.0
  • STS Version: 2.7.0.M2 Build Id: 201106101000 - 64bit Cocoa version for Mac
  • I have OS X 10.5.8. with JVM 1.5.0

当我在现有项目上运行grails命令,例如创建应用程序或升级时,我得到GantBuilder的以下NoClassDefFoundError。 (见下面的完整跟踪)

When I run a grails command eg 'create-app' or 'upgrade' on an existing project I get the following NoClassDefFoundError for the GantBuilder. (see below for full trace)

从是gant_groovy1.8-1.9.5.jar丢失。我直接将它添加到项目中,并将其添加到一个groovy / lib文件夹(并且转到STS - >首选项 - > Groovy - >编译器 - >更新所有Groovy类路径容器),但是我仍然收到错误。 (当我将gant_groovy1.8-1.9.5.jar添加到groovy / lib时,它是一个单独的groovy下载,我不知道哪个groovy / lib文件夹STS用于内部grails shell命令或如何查看STS groovy类路径)

A proposed solution for a similar problem from this forum is that gant_groovy1.8-1.9.5.jar is missing. I've added this to the project directly and also to a groovy/lib folder (and gone to STS -> preferences -> Groovy -> compiler -> Update All Groovy Classpath Containers) but I still get the error. (When I added gant_groovy1.8-1.9.5.jar to groovy/lib it was to a separate groovy download, I'm not sure which groovy/lib folder STS uses for the internal grails shell commands or how to view the STS groovy class path)

found org.springframework#spring-test;3.1.0.M1 in default
:: resolution report :: resolve 2068ms :: artifacts dl 119ms
---------------------------------------------------------------------
|                  |            modules            ||   artifacts   |
|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
|       test       |   74  |   0   |   0   |   0   ||   74  |   0   |
---------------------------------------------------------------------
Script threw exception
java.lang.NoClassDefFoundError: org.codehaus.gant.GantBuilder
    at org.codehaus.gant.GantBinding.class$(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.$get$$class$org$codehaus$gant$GantBuilder(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.<init>(GantBinding.groovy:41)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:448)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.runInteractive(GrailsScriptRunner.java:377)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:308)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:130)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)

有没有人有任何想法?

推荐答案

如果我明白是对的,Grails不要在你的groovy / lib文件夹中使用jar,而是在Grails安装文件夹中使用jar。你可能想试试这个:

If what I understand is right, Grails don't use the jar in your groovy/lib folder, but the jar in the Grails Installation folder. You may want to try this:

根据帖子,你应该去安装的Grails文件夹(%GRAILS_HOME%)。在该文件夹中,找到lib文件夹,并指定您拥有的gant_groovy.jar的正确版本。然后将%GRAILS_HOME%/ bin / startGrails.bat编辑为文本并添加以下行:

According to the post here, you should go to the Installed Grails Folder (%GRAILS_HOME%). In that folder, find the lib folder, and specify the right version of gant_groovy.jar that you have. Then edit the %GRAILS_HOME%/bin/startGrails.bat as text and add this line:

( set STARTER_CLASSPATH=%GRAILS_HOME%\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-1.8.0.jar;%GRAILS_HOME%\dist\grails-bootstrap-1.4.0.M1.jar;%GRAILS_HOME%\lib\org.codehaus.gant\gant_groovy1.8\jars\gant_groovy1.8-1.9.5.jar
)

请注意,上面的路径不是很准确(每个发行版看起来都不一样)。您应该在%GRAILS_HOME%文件夹中找到所需的jar,并相应地更改路径。

Note that the path on the above line is not very accurate(it seems different for each distribution). You should find the required jar in the %GRAILS_HOME% folder and change the path accordingly.

这篇关于Grails 1.4.0.M1(带STS 2.7.0.M2)GantBuilder的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 06:09