You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Kevin Jackson <fo...@gmail.com> on 2007/07/10 17:08:47 UTC

Accessing command line properties

Hi all,

I have a unit test which has to behave differently based on if the
test is being run normally or if the test is running within mvn with
the -o (offline switch) option.

With mvn 2.0.4, I could look at the environment variables being set
(QUOTED_ARGS for linux and MVN_CMD_LINE_ARGS for windows) to determine
if mvn was running in online or offline mode.

Now with 2.0.6 & 2.0.7, QUOTED_ARGS is no longer exported in the
mvn.sh script and therefore my unit test breaks.

I'd prefer to gain access directly to the command line arguments
instead of relying on the exported command line variables, but in
searching for a mvn api (javadoc etc) I've not really found anything
apart from some references to

org.codehaus.plexus.util.cli.Commandline; and other plexus code, again
this doesn't seem to have much in the way of documentation

Is there an elegant/cross-platform way of accessing the command line
options given to mvn within a unit test running under Surefire?

Thanks,
Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org