0

I'm playing around with ActiveJDBC and it has a post-compile step for 'instrumentation' (i.e. crudely speaking it post-process byte-code to add the parent's static members to the class as per the ActiveRecord pattern).

You constantly have to run the following command:

java -cp=$CLASSPATH -DoutputDirectory=build activejdbc.instrumentation.Main

for the post processing to take place. Is there some way to integrate this with Eclipse (Helios) so that the whenever it builds the project it triggers the above? Anyway to automate it?

I do not use Maven/Ant and do not wish to learn it just for the sake of ActiveJDBC (Maven is its only dependency, which I find is a bit annoying).

The above could be done by encapsulating it in a java file and running that file - so if there is a way to run a java file after build that'll be fine too :)

Any ideas?

PhD
  • 11,202
  • 14
  • 64
  • 112

2 Answers2

1

If you do not want to use Ant, then you can configure a second builder in Eclipse: Project -> Properties -> Builders -> New

Then you can configure to execute a shell script or a batch file with that command. Once you have that builder configured (took 5 minutes for me), you can build entire project pressing Ctrl+B, which will execute the standard builder as well as your script.

However, I'd suggest that you copy this Ant script: http://code.google.com/p/activejdbc/wiki/Instrumentation#Bare_bones_Ant_script And simply configure it for your environment. E-Riz correctly stated info about the builders, but you do not need to take an hour to write an Ant script if you are going to go this route. Configuring a new builder with Ant script instead of a shell is even simpler.

ipolevoy
  • 5,432
  • 2
  • 31
  • 46
0

I wrote about adding custom builders a few years ago: http://bewarethepenguin.blogspot.com/2008/08/customizing-builds-for-your-eclipse.html One of the options when creating a new builder is to run any arbitrary program. I don't see why you couldn't run the ActiveJDBC java command above.

Even if that doesn't work for some reason, you could probably write an Ant script to invoke that Java class in less than an hour, including learning and testing, using Ant's "java" task: http://ant.apache.org/manual/Tasks/java.html

E-Riz
  • 31,431
  • 9
  • 97
  • 134