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>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With