Based on the advice from those articles, I've put together a basic Ant script which concatenates and minifies both JS and CSS files during the build process. This could be used as a base template for frontend production code.
Here's what the script does (for details, see comments in the code):
Delete the directory created by earlier build
Recreate the directory structure to be used in new build, create timestamp
Concatenate specified files using Ant concat task
Minify the file using YUI Compressor (called from the Ant script using apply task) and add '-min' to the file name.
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
If you get that too, just copy tools.jar from earlier Java version and you're done. When everything is set up, go to Ant dir (where the build.xml file lives):
Then build the project (by default, it uses build.xml):
Here's the build.xml I've created:
Obviously, there are lots of other things you can do with Ant. There's really nothing new in this script, but it combines ideas from several articles mentioned above so I thought I'd share it here (download build.xml from GitHub). I hope it can be useful for you - I know for me it will! ;)
Update 28 March, 2011: uploaded this build.xml file to GitHub.