ArgumentProcessor is a parser of command line argument which is then
call before and after the build file is being parsed. Third party libraries may then be able to have
custom argument line argument which modify Ant behaviour.
ArgumentProcessor is called each time Ant parse an unknown argument,
ArgumentProcessor doesn't take precedence over Ant to parse already
supported options. It is then recommended to third party
implementation to chose specific 'enough' argument name, avoiding for instance one letter arguments.
It is also called at the different phases so different behaviour can be implemented. It is called
just after every arguments are parsed, just before the project is being configured (the build file
being parsed), and just after. Some of the methods to be implemented return a boolean:
true is returned, Ant will terminate immediately, without error.
Being called during all these phases, an
ArgumentProcessor can just print
some specific system properties and quit (like -diagnose), or print some specific
properties of a project after being parsed and quit (like -projectHelp), or just set some
custom properties on the project and let it run.
ArgumentProcessor must be an implementation
Then to declare it: create a file META-INF/services/org.apache.tools.ant.ArgumentProcessor which contains only one line the fully qualified name of the class of the implementation. This file together with the implementation class need then to be found in Ant's classpath.