Reputation: 451
I have a property file containing absolute paths to jars etc. When using these properties they are prefixed with the basedir specified in the build file. How do I get the absolute path?
build.properties:
mylib=/lib/mylib.jar
build.xml:
<project name="myproject" basedir=".">
<property file="build.properties"/>
...${mylib}...
</project>
Upvotes: 5
Views: 9848
Reputation: 26930
Please take a look at the property task :
http://ant.apache.org/manual/Tasks/property.html
By using the location attribute e.g. :
<property name="my.abs.path" location="my.relative.path"/>
<echo message="My abs.path is : ${my.abs.path}"/>
This will expand any relative properties to their full absolute path. Of course the path is expanded relatively to the project's basedir.
Upvotes: 6