ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Creech <m...@blueoaksoftware.com>
Subject How to Customize Relative Paths Read From Properties File
Date Thu, 27 Apr 2006 15:39:35 GMT

I want to read some relative path elements from the contents of a properties
file, and then create custom absolute paths from these elements by using a
different directory then the base directory(which is what ANT wants to add).

For example, if we had a properties file with:

   local.compile.libs=mylib1.jar;mylib2.jar
   repository.compile.libs=bos-utils.jar;junit.jar

I'd want to generate the equivalent to:

<path id="compile.classpath">
   <pathelement location="${local.dir}/lib/mylib1.jar" />
   <pathelement location="${local.dir}/lib/mylib2.jar" />
   <pathelement location="${repository.dir}/bos-utils.jar" />
   <pathelement location="${repository.dir}/junit.jar" />
</path>

where I prepend '${local.dir}/lib' and '${repository.dir}' to each path
element read.

Something that is close to doing the right thing is:

<path id="compile.classpath">
   <pathelement path="${local.compile.libs}" />
   <pathelement path="${repository.compile.libs}" />
</path>

but the problem is that ANT will make these absolute paths
based on base directory, which isn't what is desired.

Is there some simple way to do this? Do I have to write a custom task?
--
View this message in context: http://www.nabble.com/How-to-Customize-Relative-Paths-Read-From-Properties-File-t1519027.html#a4123630
Sent from the Ant - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message