1. EasyAnt
  2. EASYANT-30

Refactor EasyAnt main class to use commons-cli


    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9
    • Component/s: None
    • Labels:


      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 like:

      • 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 -Djava.net.useSystemProxies=true Foo)
      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.


        Jean-Louis Boudart created issue -
        Jean-Louis Boudart added a comment -

        Link to Apache commons-cli http://commons.apache.org/cli/

        Jean-Louis Boudart added a comment - Link to Apache commons-cli http://commons.apache.org/cli/
        Jean-Louis Boudart made changes -
        Field Original Value New Value
        Assignee Jean-Louis Boudart [ jboudart ]
        Jean-Louis Boudart made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 0.9 [ 12316192 ]
        Resolution Fixed [ 1 ]
        Jean-Louis Boudart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        3h 43m 1 Jean-Louis Boudart 20/Jul/11 18:55
        Resolved Resolved Closed Closed
        658d 21h 2m 1 Jean-Louis Boudart 09/May/13 15:57


          • Assignee:
            Jean-Louis Boudart
            Jean-Louis Boudart
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: