leif.gruenwoldt
leif.gruenwoldt

Reputation: 13957

Relative paths in Ant Property are not working

I'm trying to store a relative path to a file in my ant build.xml like this:

<property name="foo" location="somedir/myfile" relative="true"/>

According to the Ant manual for Property this is ok syntax, but when running it Ant says:

property doesn't support the "relative" attribute

I'm using Apache Ant version 1.7.1 compiled on August 13 2009

Upvotes: 1

Views: 4893

Answers (2)

Alexander Pogrebnyak
Alexander Pogrebnyak

Reputation: 45576

Manual that came with 1.7.1 distribution does not mention relative property.

If you look at the top of ant manual link, it says 1.8.0RC1. I guess these are new 1.8.0 attributes of property task. Probably you should report a bug to the ant team to mark relative and basedir attributes as Since 1.8.0

On the other hand if you need a relative path to a basedir, just use a value attribute of property task.

-- UPDATE

I've submitted a bug to ant team

Upvotes: 3

Aito
Aito

Reputation: 6872

I think that if in the location is not specified the root path ('/') which is absolute , it takes relative as default, so the "relative=true" is unnecesary.

location Sets the property to the absolute filename of the given file. If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions). Otherwise it is taken as a path relative to the project's basedir and expanded. (from the documentation)

Upvotes: 0

Related Questions