customCallBack.xml
script. Inside this script you had to call out to a special groovy.jdtcompile
ant task, using a magic set of classpath references. When this approach worked, it did so by first compiling your Java code (with errors of course since your groovy code is not touched), and then re-compiling all your code using the joint compiler provided by Groovy-Eclipse.Not so pretty. It works for Groovy-Eclipse, but that is only because I know exactly what its limitations are and how to work around them.
A short while ago, I wrote about how we re-implemented PDE build for projects that use the AspectJ compiler. I've recently done the same for plugin projects that use Groovy.
Here's how it works:
- Install the latest dev snapshot of Groovy-Eclipse for Helios (you can write plugins that target Galileo (Eclipse 3.5), but you must use the Helios PDE builder to create the plugins).
- For each of your plugin projects, add the following to your
build.properties
file:
sourceFileExtensions=*.java, *.groovy compilerAdapter=org.codehaus.groovy.eclipse.ant.GroovyCompilerAdapter compilerAdapter.useLog=true # this ensures that exceptions are logged to the proper log file.
- Now you can run your PDE export (either headless or from within a running Eclipse using one of the Export wizards).
The only caveat is that each plugin project must contain at least one
.java
file or else the PDE builder will ignore that plugin. The problem is described in Bug 318951. Before this can be addressed, I need a patch committed to the javac task, described here: Apache Bug 48829 (please vote the bug up if you want to see this fixed!).With that, creating Groovy-based Eclipse plugins now requires much, much less black magic.
Thanks for your post, exactly what I was looking for.
ReplyDeleteCan you perhaps lead me to some source where such Groovy-specific Eclipse additions are described?
lero, what exactly are you looking for?
ReplyDeleteNevermind, when I wrote the comment I wasn't aware of how the properties in the build.properties file were used. Turned out all I was looking for was the Eclipse help ^^
ReplyDeleteThanks Andrew, you made my day. I spent 2 days of developing plugin in groovy which worked like a darling from Eclipse, but didn't work on export - the groovy files were not compiled and were present in plugin jar as .groovy.
ReplyDeleteAdding to the build.properties as you mentioned helped!
Thanks!
ReplyDelete