Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4285

CliManager.parse() cannot be called from within a mojo

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1.0, 2.2.0
    • None
    • None
    • None

    Description

      As reported by Benjamin Bentmann:

      as per MNG-4024, the CLIManager was exposed to the public API. Its parse() method returns a CommandLine object from commons-cli. Per MNG-4166, commons-cli is no longer filtered from the plugin realm.
      
      This constellation prohibits the usage CLIManager.parse() from Maven 2.2.x in plugins as the returned CommandLine originates from the core realm and isn't type-compatible with the same class from the plugin realm.
      
      So, do we have a better option than to extend the Javadoc of CLIManager in order to clearly state that it's for integrators only and not for plugins? 
      

      After discussing with him a little more on IRC, he suggested wrapping the return type from the CliManager.parse() method such that we're not passing around objects from the commons-cli API. One ready-made alternative to the commons-cli classes might be MavenExecutionRequest...returning this might enable plugins to use a standard interface to interact with Maven's CLI-parsing while at the same time hiding the conflicting commons-cli classes.

      We can't make a change like this in 2.2.x, but it makes a lot of sense to pursue for 2.3.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jdcasey John Dennis Casey
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: