Absolute paths in the Ant properties file

I have a properties file containing absolute paths to jars, etc. When using these properties, they have a prefix with the name specified in the assembly file. How to get the absolute path?

build.properties:

mylib=/lib/mylib.jar

build.xml

<project name="myproject" basedir=".">
  <property file="build.properties"/>
  ...${mylib}...
</project>
+5
source share
1 answer

Please take a look at the task properties:

http://ant.apache.org/manual/Tasks/property.html

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 complete absolute path. Of course, the path is expanding relative to the project based.

+6
source

All Articles