Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not compiling Groovy scripts into java classes at runtime

Strangely I am not having any compile-time error but while running the application I am getting NoClassDefFound error for Groovy classes.

I am using Eclipse 3.6 with Groovy 2.7.0 plugin. I have Groovy 1.8.5 installed on my machine and groovy-all.jar is in my classpath of application.

I can see all the groovy files in WEB-INF/classes folder with .groovy extension not with .class extension.

What I am missing here?

like image 975
Himanshu Yadav Avatar asked May 08 '12 13:05

Himanshu Yadav


1 Answers

Two possibilities:

  1. You project is not a groovy project and so your groovy files are being treated as resources (not sources). Resources are copied to the output folder, whereas sources are compiled. Make sure that your project icon has a little GR symbol on it.

  2. Or perhaps you have inadvertently enabled script folders for the source folder where your groovy files are located. Go to Preferences -> Groovy -> Compiler and look at the section on Groovy Script Folders. Note that Groovy Script folders can also be configured on a per-project basis, so you may also need to look at Project -> Properties -> Groovy Compiler.

like image 153
Andrew Eisenberg Avatar answered Sep 21 '22 15:09

Andrew Eisenberg