You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by james_d <ja...@gmail.com> on 2009/01/21 23:57:24 UTC

Passing system properties to JUnit tests using "-D" on Linux


When I compile/test my software on Windows any -D system properties I
specify on the command line (e.g., mvn clean install -Dkey1=value1) are
available inside my JUnit tests by calling the System.getProperty() method
(e.g., System.getProperty("key1") returns "value1").  

However, I noticed that when I run my build on Linux that the properties are
not available.  Specifically, calling System.getProperty("key1") returns
null.  What's going on?  I'm using maven 2.0.9 for both.

Thanks for the help!
-- 
View this message in context: http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21593651.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Passing system properties to JUnit tests using "-D" on Linux

Posted by james_d <ja...@gmail.com>.
Thanks Dan!

I switched to Surefire plugin version 2.4.2 on my Linux build machine and
that solved my problem.  


Dan Tran wrote:
> 
> http://jira.codehaus.org/browse/SUREFIRE-121
> 
> 
> 2009/1/22 Jeff MAURY <je...@jeffmaury.com>:
>> Maven it is a problem from the mvn shell script not passing this infos
>> the
>> same way on Windows and Linux.
>>
>> Regards
>> Jeff MAURY
>>
>> On Thu, Jan 22, 2009 at 7:56 AM, Jaikiran
>> <ja...@yahoo.co.in>wrote:
>>
>>>
>>>
>>>
>>> james_d wrote:
>>> >
>>> > However, I noticed that when I run my build on Linux that the
>>> properties
>>> > are not available.  Specifically, calling System.getProperty("key1")
>>> > returns null.  What's going on?  I'm using maven 2.0.9 for both.
>>> >
>>> The OS shouldn't matter, it should have worked. Please post the exact
>>> command that you are using and the piece of code where you using this
>>> property. Also post the output of
>>>
>>> mvn -version
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21598842.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
>> --
>> La mélancolie c'est communiste
>> Tout le monde y a droit de temps en temps
>> La mélancolie n'est pas capitaliste
>> C'est même gratuit pour les perdants
>> La mélancolie c'est pacifiste
>> On ne lui rentre jamais dedans
>> La mélancolie oh tu sais ça existe
>> Elle se prend même avec des gants
>> La mélancolie c'est pour les syndicalistes
>> Il faut juste sa carte de permanent
>>
>> Miossec (2006)
>>
>> http://www.jeffmaury.com
>> http://riadiscuss.jeffmaury.com
>> http://www.lastfm.fr/listen/user/jeffmaury/personal
>> Mes CDs à récupérer:
>> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21609247.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Passing system properties to JUnit tests using "-D" on Linux

Posted by Dan Tran <da...@gmail.com>.
http://jira.codehaus.org/browse/SUREFIRE-121


2009/1/22 Jeff MAURY <je...@jeffmaury.com>:
> Maven it is a problem from the mvn shell script not passing this infos the
> same way on Windows and Linux.
>
> Regards
> Jeff MAURY
>
> On Thu, Jan 22, 2009 at 7:56 AM, Jaikiran <ja...@yahoo.co.in>wrote:
>
>>
>>
>>
>> james_d wrote:
>> >
>> > However, I noticed that when I run my build on Linux that the properties
>> > are not available.  Specifically, calling System.getProperty("key1")
>> > returns null.  What's going on?  I'm using maven 2.0.9 for both.
>> >
>> The OS shouldn't matter, it should have worked. Please post the exact
>> command that you are using and the piece of code where you using this
>> property. Also post the output of
>>
>> mvn -version
>> --
>> View this message in context:
>> http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21598842.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.lastfm.fr/listen/user/jeffmaury/personal
> Mes CDs à récupérer:
> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>

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


Re: Passing system properties to JUnit tests using "-D" on Linux

Posted by Jeff MAURY <je...@jeffmaury.com>.
Maven it is a problem from the mvn shell script not passing this infos the
same way on Windows and Linux.

Regards
Jeff MAURY

On Thu, Jan 22, 2009 at 7:56 AM, Jaikiran <ja...@yahoo.co.in>wrote:

>
>
>
> james_d wrote:
> >
> > However, I noticed that when I run my build on Linux that the properties
> > are not available.  Specifically, calling System.getProperty("key1")
> > returns null.  What's going on?  I'm using maven 2.0.9 for both.
> >
> The OS shouldn't matter, it should have worked. Please post the exact
> command that you are using and the piece of code where you using this
> property. Also post the output of
>
> mvn -version
> --
> View this message in context:
> http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21598842.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal
Mes CDs à récupérer:
http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en

Re: Passing system properties to JUnit tests using "-D" on Linux

Posted by Jaikiran <ja...@yahoo.co.in>.


james_d wrote:
> 
> However, I noticed that when I run my build on Linux that the properties
> are not available.  Specifically, calling System.getProperty("key1")
> returns null.  What's going on?  I'm using maven 2.0.9 for both.
> 
The OS shouldn't matter, it should have worked. Please post the exact
command that you are using and the piece of code where you using this
property. Also post the output of

mvn -version
-- 
View this message in context: http://www.nabble.com/Passing-system-properties-to-JUnit-tests-using-%22-D%22-on-Linux-tp21593651p21598842.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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