You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by twiddle-dee12 <ha...@gmail.com> on 2011/10/24 11:51:00 UTC

How do I get a property treated as a value rather than a location?

Hi,

I'm not a particularly strong user of ant so please bear with me. Is there a
way of getting a property in a property file treated as a value rather than
a location? For example, I have the following:

build.property:
mytest.dir="/tmp/jon"

build.xml:
.
.
.
<property file="build.property" />
.
.
.
<target name="fred">
  <mkdir dir="${mytest.dir}" />
</target>

The directory ${mytest.dir} will be created where I am running the ant
script from (in an eclipse workspace) rather than in /tmp. If I declare the
property in the build.xml then I get the behaviour I desire - but that seems
to be a bit kludgy,

Harold.



--
View this message in context: http://ant.1045680.n5.nabble.com/How-do-I-get-a-property-treated-as-a-value-rather-than-a-location-tp4931907p4931907.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: How do I get a property treated as a value rather than a location?

Posted by "Holman, Chris" <Ch...@bskyb.com>.
You could use this:

<mkdir dir="${basedir}${mytest.dir}" />

Regards,
Chris Holman
LinkedIn: http://uk.linkedin.com/in/chrisdholman

-----Original Message-----
From: twiddle-dee12 [mailto:harold.thurnstein@gmail.com] 
Sent: 24 October 2011 10:51
To: user@ant.apache.org
Subject: How do I get a property treated as a value rather than a location?

Hi,

I'm not a particularly strong user of ant so please bear with me. Is there a
way of getting a property in a property file treated as a value rather than
a location? For example, I have the following:

build.property:
mytest.dir="/tmp/jon"

build.xml:
.
.
.
<property file="build.property" />
.
.
.
<target name="fred">
  <mkdir dir="${mytest.dir}" />
</target>

The directory ${mytest.dir} will be created where I am running the ant
script from (in an eclipse workspace) rather than in /tmp. If I declare the
property in the build.xml then I get the behaviour I desire - but that seems
to be a bit kludgy,

Harold.



--
View this message in context: http://ant.1045680.n5.nabble.com/How-do-I-get-a-property-treated-as-a-value-rather-than-a-location-tp4931907p4931907.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



Information in this email including any attachments may be privileged, confidential and is intended exclusively for the addressee. The views expressed may not be official policy, but the personal views of the originator. If you have received it in error, please notify the sender by return e-mail and delete it from your system. You should not reproduce, distribute, store, retransmit, use or disclose its contents to anyone. Please note we reserve the right to monitor all e-mail communication through our internal and external networks. SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and are used under licence. British Sky Broadcasting Limited (Registration No. 2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited (Registration No. 2340150) are direct or indirect subsidiaries of British Sky Broadcasting Group plc (Registration No. 2247735). All of the companies mentioned in this paragraph are incorporated in England and Wales and share the same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How do I get a property treated as a value rather than a location?

Posted by Stefan Bodewig <bo...@apache.org>.
On 2011-10-24, twiddle-dee12 wrote:

> Hi,

> I'm not a particularly strong user of ant so please bear with me. Is there a
> way of getting a property in a property file treated as a value rather than
> a location? For example, I have the following:

> build.property:
> mytest.dir="/tmp/jon"

Are the quotes around /tmp/jon a typo?  You don't need quotes in
property files.

> <property file="build.property" />
> .
> <target name="fred">
>   <mkdir dir="${mytest.dir}" />
> </target>

> The directory ${mytest.dir} will be created where I am running the ant
> script from

This should not happen.  What is the literal value of ${mytest.dir} when
you <echo> it?  Since the value starts with a / Ant will know it is an
absolute path and things should work as you expect them.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org