You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Costin Caraivan <cc...@axway.com> on 2009/12/02 13:55:31 UTC

How to access Maven default properties from a Junit test?

Hello,

Does Maven pass the default properties to a Junit test launched? If so, how
can I access them?

For example I would like to know ${project.groupId} or ${project.version}.
Is there any way I can access these from the Junit tests?

Thank you,
Costin.

PS: What I really want to know if there is a mechanism in place, I don't
really want to fill the configuration with duplicate properties, or make a
temporary file which I read later. If there's no elegant solution, I'll just
read the from somewhere :)
-- 
View this message in context: http://old.nabble.com/How-to-access-Maven-default-properties-from-a-Junit-test--tp26608418p26608418.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: How to access Maven default properties from a Junit test?

Posted by Jamie Whitehouse <Ja...@genesyslab.com>.
As you suggest you can also read them in from somewhere.  Create a test
resources property file that gets filtered and read that.  Much simpler
and easier to maintain when there's more than a few properties.

-----Original Message-----
From: Dan Tran [mailto:dantran@gmail.com] 
Sent: Wednesday, December 02, 2009 9:25 AM
To: Maven Users List
Subject: Re: How to access Maven default properties from a Junit test?

You need to pass them in explicitly using surefire plugin's properties
configuration

-D

On Wed, Dec 2, 2009 at 4:55 AM, Costin Caraivan <cc...@axway.com>
wrote:
>
> Hello,
>
> Does Maven pass the default properties to a Junit test launched? If 
> so, how can I access them?
>
> For example I would like to know ${project.groupId} or
${project.version}.
> Is there any way I can access these from the Junit tests?
>
> Thank you,
> Costin.
>
> PS: What I really want to know if there is a mechanism in place, I 
> don't really want to fill the configuration with duplicate properties,

> or make a temporary file which I read later. If there's no elegant 
> solution, I'll just read the from somewhere :)
> --
> View this message in context: 
> http://old.nabble.com/How-to-access-Maven-default-properties-from-a-Ju
> nit-test--tp26608418p26608418.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
>
>

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


					
-------------------------------------------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: This e-mail and any files attached may contain confidential and proprietary information of Alcatel-Lucent and/or its affiliated entities. Access by the intended recipient only is authorized. Any liability arising from any party acting, or refraining from acting, on any information contained in this e-mail is hereby excluded. If you are not the intended recipient, please notify the sender immediately, destroy the original transmission and its attachments and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Copyright in this e-mail and any attachments belongs to Alcatel-Lucent and/or its affiliated entities.
					

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


Re: How to access Maven default properties from a Junit test?

Posted by Dan Tran <da...@gmail.com>.
You need to pass them in explicitly using surefire plugin's properties
configuration

-D

On Wed, Dec 2, 2009 at 4:55 AM, Costin Caraivan <cc...@axway.com> wrote:
>
> Hello,
>
> Does Maven pass the default properties to a Junit test launched? If so, how
> can I access them?
>
> For example I would like to know ${project.groupId} or ${project.version}.
> Is there any way I can access these from the Junit tests?
>
> Thank you,
> Costin.
>
> PS: What I really want to know if there is a mechanism in place, I don't
> really want to fill the configuration with duplicate properties, or make a
> temporary file which I read later. If there's no elegant solution, I'll just
> read the from somewhere :)
> --
> View this message in context: http://old.nabble.com/How-to-access-Maven-default-properties-from-a-Junit-test--tp26608418p26608418.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
>
>

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