I have inherited a Java application (servlets) that runs under Tomcat. For historical reasons, the code has different “look and feel” options based on where the application will be deployed (essentially a matter of branding).
There are several constants that control this branding process, which have different functions and should not be compacted into a single constant (i.e. BRAND, MULTI-LANGUAGE, plus the locations of icons and css style sheets, etc.).
Currently the development team must manually change the constants (they are at least localized in one data class and well documented), then recompile the application using ANT.
What is the best way to automate this process assuming at least Ant 1.8 and Java 6.x?
I know that there have not been any good solutions using compiler arguments (like one could do in C or C++), and am leaning to some “best way” to edit either the source file containing the constants, or putting them into another file and swapping them out using the ant build process. I’d like to have a result that would work using something like “ant build brand-x” where changing the brand would change the resulting build.
Use the replace task in Ant to change the values.