I’d like to create a build system in Ant which makes heavy use of property inheritance.
I see that Ant allows in a .properties file as input, however, i’d like to input multiple properties files perhaps with some values overriding others.
Is this even possible using Ant or do i need to write it myself and to create the final .properties file?
You can certainly use multiple properties files – the important thing to keep in mind though, is that Ant properties are immutable – once set, they cannot be changed. So the first properties file to set a property wins. Given this, you should begin with the ‘most specific’ file first and include the default or the parent file last.
Here’s an article that talks about this in some detail. From the command line, you might do this:
Properties defined in
level_2will ‘override’ properties with the same names inlevel_1which in turn override properties inbase.