«    »

EnvGen – the Environment-Specific File Generator

I have added a new software utility called EnvGen to my Software page. EnvGen is an Ant task for generating different versions of the same file parameterized for different environments (i.e. development, test, and production). File generation is done using FreeMarker, a template engine with a full-featured templating language. You specify environment-specific properties in a CSV file (comma separated value spreadsheet). EnvGen functions similar to Ant's Copy task: you run EnvGen against one or more source filesets into a target directory. Rather than simply copying each file over, EnvGen generates a version of the target file for each environment specified in the properties CSV file. Usually the target directory or filename is parameterized by environment so that EnvGen writes each version to a different physical file.

In my previous article on Designing for Deployability, I wrote about generating files per environment as one approach to handling environmental differences. EnvGen is designed to allow you to easily use this approach.

You can read more about EnvGen in the EnvGen Release Documentation.

If you find this article helpful, please make a donation.

«    »