1

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?

skolima
  • 31,963
  • 27
  • 115
  • 151
dogukan sonmez
  • 335
  • 3
  • 8
  • I would say that `CallSite` is not in your classpath but that is to obvious isn't it? You can try `"ant".execute().waitFor()` if you just want to start ant and wait until the process finshed. – Peter Feb 09 '12 at 12:22
  • thanks for your comment CallSite is already in classpath. I guess the problem is related to version of grails. – dogukan sonmez Feb 10 '12 at 08:24

1 Answers1

1

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:

  1. Removed all the files in ~/.grails/YOUR_GRAILS_VERSION/scriptCache/ folder.
  2. Remove Groovy bin from path or use the correct groovy version in your local

Whenever you called, Grails will compile the scripts with the correct groovy version. I hope that helps.

lemiorhan
  • 1,434
  • 11
  • 18