Grails 1.4.0.M1 (with STS 2.7.0.M2) NoClassDefFoundError for GantBuilder
I have just upgraded to...
- 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
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)
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.GrailsScriptR开发者_开发问答unner.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)
Does anyone have any ideas?
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:
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
)
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.
精彩评论