It couldn't get easier, this compile script will precompile your JSPs into the tomcat work folder so that you can have precompiled jsps and enjoy the ability to change your JSPs on the fly.
Note:This script only works on exploded wars, so it is a good idea to run it after tomcat has started if you are deploying .war files
Step by Step
- Download Ant Contrib v0.4 and store it in your $ANT_HOME/lib folder
- Download the ANT precompile script and store it anywhere you want
- Open a command line interface in the same directory as your precompile script
- run the command
ant -Dtomcat.home=/usr/local/tomcat -Dwebapp.name=mywebappname -buildfile tomcat-precompile-jsp.xml and watch your JSPs be precompiled. Your war must be exploded and the webapp name is the name of the directory (the war name minus .war)
Tomcat 6 Build script to precompile JSPs (This does not require ant-contrib libraries)
For the advanced user, upon tomcat startup, you can create a shell script that runs this for each webapp.
For the advanced user 2, set the parallel attribute in the <foreach parallel="true"> to true, for better performance