I am not sure but I think that the previous comments about DOS or Unix were trying to point out that variables on the command line are transformed by the operating system PRIOR to Maven getting them so you need to find a way to get your operating system to read your command line and transform it into something that will get passed to Maven in a form that you want.

You said :

If I write mvn blah -Dprop1=${prop2} Maven sets prop1 to null.

This is not correct.
What you should have written is
If I write mvn blah -Dprop1=${prop2} my operating system converts 
-Dprop1=${prop2} to -Dprop1=null
before passing it to Maven, since it has no environment called prop2 so it converts it to 
"null".

Then you said:
If I write mvn blah -Dprop1=$${prop2} it sets prop1 to $null
What you should have said was:
If I write mvn blah -Dprop1=$${prop2} the OS convertss -Dprop1=$${prop2} to 
-Dprop1=$null
before passing it to Maven since it thinks prop2 is not defined (ie null).

You fight is with your OS not Maven.

You might want to test this with the echo command rather than mvn to see the 
actual arguments that will get sent to the program.

I hope that this helps.


Ron
On 22/04/2011 10:40 PM, Phillip Hellewell wrote:
I appreciate the two responses, but no one seems to be grasping what
I'm talking about.

Erase from your mind anything about %dos_env_vars% or $unix_env_vars.
My question has exactly 0 to do with env vars.

My question is about maven properties.  In a pom file I can set a
property to the value of another property by writing
<prop1>${prop2}<prop1>, or if I want to set it to the literal value
"${prop2}" I can write<prop1>$${prop2}<prop1>.  The extra $ escapes
it and keeps it from getting interpolated.

However, on the command-line, I cannot find any way to accomplish the
same thing.  If I write mvn blah -Dprop1=${prop2} Maven sets prop1 to
null.  If I write mvn blah -Dprop1=$${prop2} it sets prop1 to $null.
The only way I have found to keep it from interpolating is by
appending text.

Is this by design or a bug?  I'd say it is a bug because if it's going
to interpolate at all it ought to be consistent and should work the
same way as when inside a pom file.

Phillip

On Thu, Apr 21, 2011 at 6:16 PM, Sony Antony<[email protected]>  wrote:
I think %myvar2% will result in windows shell doing teh substitution
I dont think maven will use system variables set using -D as pom variables (
maybe I m wrong )
--sony
On Thu, Apr 21, 2011 at 7:24 PM, Phillip Hellewell<[email protected]>  wrote:

This is on Windows from a command prompt, not Linux.

Phillip

On Thu, Apr 21, 2011 at 12:21 PM, Jörg Schaible<[email protected]>
wrote:
Phillip Hellewell wrote:

Oh, I just thought of something shorter that will work:

-Dmyvar1=c:\test\${myvar2}\.

Still seems kinda crazy though.  Anyone want to shed some light on why
it works this way?  This is with Maven 3.0.1.
Maybe you should have a look into the bash manual instead ?

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to