Use
ANT. (
http://ant.apache.org/)
Asuming that your source code is in the directory c:\projects\demo\src and the build.xml file in in the c:\projects\demo, then this ANT-file builds, packs and documents the project.
This is my basic ant script, also found in the ant-documentation.