Continous integration issues with Ant(hill)

Anthill is a small, easy to configure automatic build and publish environment.
I don’t want to discuss the deployment and configuration of the tool itself, I’d rather highlight the main issues that we had on using Anthill to automatically build and deploy our ongoing projects.

Hard to identify InvocationTarget exceptions
Our build environment was a Tomcat 6.0.x running on Sun JDK 1.6 on Debian Linux on x86, while the test and production environments are Websphere Application Servers 6.0.12 running the default IBM JDK 1.4.2 on AIX on Power5. Upon deploying to the test server we used the images created on the build environment using the Anthill’s build as version functions. Since the target source and target levels are Java 1.4, these options were specified in the javac ant task, so the code produced can run on the target environments.
This setup worked perfectly for months on our projects, but after a while strange exceptions started popping up on the test server. Compiling and deploying the application using the same options as the ones set in Anthill on our local Websphere servers got rid of the problems, while the one deployed on the AIX running the WAS we got the exceptions. Since there didn’t seem to be any difference between the builds we didn’t suspect Anthill for quite a time, and thought it was some strange JDK problem on AIX.
The simple code:
new BigDecimal(1);
worked perfectly on our Tomcat, on our local WAS but threw an exception on the test server’s WAS. Changing the code to
new BigDecimal("1");
worked perfectly on all environments.
A collegue worked out the reason after a few days of searching. He noticed, that these issues occur, when we use methods, that have been extended in Java 1.5. For example the code above would map to BigDecimal(int i) while it will map to BigDecimal(double d). We realized, that however the generated code will be created to be ran under Java 1.4, it will be compiled for the actual runtime of the ant ran from the Anthill. Since the JRE in WAS doesn’t contain the signatures for the given method, this will throw the InvocationTargetException, which looks strange at that point of the code.
After identifying the problem, solving it was quite easy after checking out the official documentation, changing the javac block to look something like:


and passing the option -Djava.home=/my/jdk/home/dir will enable to build the project both under Anthill and Eclipse.

Publishing under WAS
Our current project is to be deployed on WebSphere, and we wanted to use Anthill to deploy automatically on WAS. This is a real pain in the backside, since if you take FOSS servlet containers and application servers (Tomcat, Jetty, Jboss, Geronimo), they are pretty friendly when it comes to deploying an application on. You just copy the WAR/EAR in a directory and it is deployed automatically. On WAS hovewer this is not half as simple.
WAS has a very specific way of accessing the administration interface ws_ant. It first seems like a very simple shell script running ant scripts, but try as you might you’ll never be able to invoke it from inside your normal ant. Rumor has it, that IBM modified the ant for some weird reason. After several failed attempts, we used the most trivial and ugly way to invoke the tasks.
Based on the forums and even IBM’s InfoCenter it seems that invoking the ws_ant with the exec task with the required arguments. I have to mention two points here, one is that there seems to be no way to handle the return value of the exec. The other is that it’s quite annoying, that all arguments of the exec must be specified using separate args.

2 thoughts on “Continous integration issues with Ant(hill)

  1. We started using Hudson as well for some projects.

    I miss the publish feature I had in anthill. That’s really convenient for keeping an up-to date version of the stable application builds.

    I’d appreciate if you provided some pointers on how you use Hudson, especially if you have some unit testing/code coverage experience, and how could you use it to do the publish only after successful builds?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.