You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Hayes, Peter" <Pe...@fmr.com> on 2001/04/03 19:11:57 UTC
Obtaining properties
Hi,
I would like to obtain a property by using another property to get it.
I have a prop file like this
---------------------
proj1.run.main = com.xxx.Project1
proj2.run.main = com.xxx.Project2
---------------------
In my build.xml I would like to figure out which project to run based on a
passed in property. (-Dproject=proj1)
So in my target would be something like
<property name="main" value="${project}.run.main" />
But instead of main being set to the string "proj1.run.main" I would like to
'dereference' that so it would get the previously set value
('com.xxx.Project1')
Is this possible w/ ANT
Thanks.
Peter Hayes
GETT, Fidelity Investments
Re: Obtaining properties
Posted by Anuj Agrawal <ag...@lucent.com>.
Did you try:
<property name="tempMain" value="${project}.run.main" />
<property name="main" value="${tempMain}" />
??
Anuj.
"Hayes, Peter" wrote:
> I would like to obtain a property by using another property to get it.
>
> I have a prop file like this
> ---------------------
> proj1.run.main = com.xxx.Project1
> proj2.run.main = com.xxx.Project2
> ---------------------
>
> In my build.xml I would like to figure out which project to run based on a
> passed in property. (-Dproject=proj1)
>
> So in my target would be something like
>
> <property name="main" value="${project}.run.main" />
>
> But instead of main being set to the string "proj1.run.main" I would like to
> 'dereference' that so it would get the previously set value
> ('com.xxx.Project1')
Re: Obtaining properties
Posted by Diane Holt <ho...@yahoo.com>.
I can't think of any way right off-hand to do what you want (doesn't mean
there isn't a way, just that I can't think of one real quick :) -- but
wouldn't it be easier to just set "main" to "com.xxx.${project}" and
define ${project} with -Dproject="Project1"?
Diane
--- "Hayes, Peter" <Pe...@fmr.com> wrote:
> I would like to obtain a property by using another property to get it.
>
> I have a prop file like this
> ---------------------
> proj1.run.main = com.xxx.Project1
> proj2.run.main = com.xxx.Project2
> ---------------------
>
> In my build.xml I would like to figure out which project to run based on
> a passed in property. (-Dproject=proj1)
>
> So in my target would be something like
>
> <property name="main" value="${project}.run.main" />
>
> But instead of main being set to the string "proj1.run.main" I would
> like to 'dereference' that so it would get the previously set value
> ('com.xxx.Project1')
>
> Is this possible w/ ANT
>
> Thanks.
>
> Peter Hayes
> GETT, Fidelity Investments
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/