Reputation: 335
I have following script which is aim to make a war file.
def ant = new AntBuilder()
ant.ant(antfile:'build.xml', dir:APP_ROOT, target:'war')
unfortunately I am getting following error when groovy try to run ant.ant(... line
Error executing script War: [Lorg/codehaus/groovy/runtime/callsite/CallSite;
[exec] java.lang.NoClassDefFoundError: [Lorg/codehaus/groovy/runtime/callsite/CallSite;
[exec] at java.lang.Class.getDeclaredMethods0(Native Method)
[exec] at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
[exec] at java.lang.Class.getDeclaredMethods(Class.java:1791)
[exec] at org.codehaus.groovy.reflection.CachedClass$1.run(CachedClass.java:134)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:131)
I was wondering is there an other way to make war file with antbuilder in groovy?
Upvotes: 1
Views: 1326
Reputation: 1480
It seems the problem occurs if the groovy dependency of your grails is different than the groovy version installed on your local. I could reproduce the same issue when I tried to call grails war
for a grails version dependent to Groovy 1.5 with Groovy 1.6 already installed. (BTW, Grails-1.0-RC3 is dependent to Groovy 1.5.0 and CallSite is introduced in Groovy-1.6.) When you call grails war
, grails compiles its scripts by a wrong groovy version and fills the script cache.
To resolve this kind of issues, what I did is:
~/.grails/YOUR_GRAILS_VERSION/scriptCache/
folder. Whenever you called, Grails will compile the scripts with the correct groovy version. I hope that helps.
Upvotes: 1