incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Louis Boudart (JIRA)" <>
Subject [jira] [Created] (EASYANT-30) Refactor EasyAnt main class to use commons-cli
Date Wed, 20 Jul 2011 15:13:06 GMT
Refactor EasyAnt main class to use commons-cli

                 Key: EASYANT-30
             Project: EasyAnt
          Issue Type: Improvement
            Reporter: Jean-Louis Boudart

We originally forked the Ant's main class to add our options (as the original class was not
fully designed to be extends for our needs).

Then we started implementing new kind of command line switches and called it ManCommands.
Thoses ManCommands were designed to make complex features accessible from the commande line
* listTargets : Lists all targets available
* listTargets [arg] : Lists all targets associated with the specified phase / plugin as argument
* listPhases : Lists all phases available
* listPugins : Lists all plugins imported in the current project
* listProps [plugin] : Lists all properties available in the specified plugin
* describe [arg] : Describes a phase / target / property specified by argument

To create new "mancomands" you were obligated to implements ManCommand interface, modify easyant
main to "handle" the new switch and modify the usage.

My concern is about maintenance of "usage" section it was never updated.

I would suggest to refactor our main class and use an apache library => commons-cli.
As main advantages, i see "usage" or help generator, an easier and stronger mechanism for
parameter handling. 
Commons cli support :
    POSIX like options (ie. tar -zxvf foo.tar.gz)
    GNU like long options (ie. du --human-readable --max-depth=1)
    Java like properties (ie. java -Djava.awt.headless=true
    Short options with value attached (ie. gcc -O2 foo.c)
    long options with single hyphen (ie. ant -projecthelp)

As a minor drawback easyant-core will have one more dependency, but if this is a real problem
we could split easyant-core in two distinct module "core", and "cli" where "cli" will containing
the main class "ManCommand" and the dependency on Apache commons-cli.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message