CliManager.parse() cannot be called from within a mojo
------------------------------------------------------
Key: MNG-4285
URL: http://jira.codehaus.org/browse/MNG-4285
Project: Maven 2
Issue Type: Bug
Affects Versions: 2.2.0, 2.1.0
Reporter: John Casey
As reported by Benjamin Bentmann:
{noformat}
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?
{noformat}
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira