In tomcat5 we started to do the precompilation as part of the build process - right now we use the tomcat-specific task.
Let me know when you finish backporting - I'll test it with tomcat5 buildfile, and after next ant1.5 release we can switch the tomcat build file. Costin