Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Absolute paths in Ant property file

Tags:

properties

ant

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>
like image 971
aandeers Avatar asked Oct 20 '11 14:10

aandeers


1 Answers

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.

like image 62
FailedDev Avatar answered Sep 27 '22 15:09

FailedDev