You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kevin Jackson <fo...@gmail.com> on 2007/04/06 10:35:23 UTC

Access command line args in a unit test

Hi all,

I have a utility class that is tested via a Test class via surefire/junit4.

I want to test if the parameter "-o" has been passed as a command to
the maven command line.

Prior versions of mvn allowed me to access the args via :
System.getenv("MAVEN_COMMAND_LINE_ARGS") (on windows) or
System.getenv("QUOTED_ARGS") on linux (why do the launch scripts for
the two platforms use different variable names?)

The problem now is that since the release of 2.0.6, the QUOTED_ARGS
value is no longer being exported in the mvn shell script.

As this wasn't mentioned in the release notes for mvn2.0.6, I have now
to build a workaround so that should the maven team decide to randomly
change the shell scripts and batch files, I have a more robust
solution in place that won't break.

Is there any other way of getting access to the command line args from
a class without going through the System.getenv - so far I've found no
way of accessing the -o value that I pass in on mvn2.0.6.

Any hints/advice welcome.

Thanks,
Kev

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