I am building a Java project into WAR file with different Ant scripts, e.g. buildDev.xml, buildUAT.xml, buildProduction.xml, etc...
Inside each script, I can use property
to set different properties for the different builds, e.g.
<property name="myDir" value="foo" />
However, outside of the Ant script, I can't think of any ways to have certain blocks of Java code being included or excluded depending on different builds...
In C++, C#, or some other languages, I can use preprocessor like this:
#if defined(DEV_BUILD)
runThisForDevBuild();
#elif defined(PRODUCTION_BUILD)
runThisForProductionBuild();
#else
printError();
#endif
I understand that preprocessor is not a thing in Java, but I wonder if Ant, using different means, would allow me to achieve something like the above in Java?