Friday, July 14, 2006

 

Using apt with Ant.


apt (annotation processing tool) is a tool that comes with JDKs versions 1.5 onwards. It performs the desired transformations on annotated source code. As we need it for our builds (to run over code containing JAXB annotations) I decided to search for an Ant task to do this (not really wanting to write one myself!). The latest stable version of Ant is 1.6.5. This does not yet have an apt task. Out of interest I had a look at a checkout of the HEAD of the Ant CVS repository. This does, but the version of Ant overall is only described as 1.7-alpha. After some googling, I uncovered from a tutorial that there is one in Sun's JWSDP, or more specifically JAX-WS. You don't need all of the JWSDP, just JAX-WS 2.0 standalone is fine. The main drawback I found is that it doesn't do dependancy checking, therefore I have to add my own "up-to-date" check in the build.xml to compare the timestamps of source code and apt-generated class files, but otherwise, everything works OK.


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?