Question

I have an Ant Build script to build my project. It is so large that it takes 40 minutes to run. Instead of running it 40 minutes and failing, I'd thought I'd ask the StackOverflow community first. Is the following legal?

<property name="configDir" value="${basedir}/../Server"/>

The value of ${basedir} is C:\workspaces\antbuild\stephen\BuildResources

I have the .. in the value because I want to access the Server folder, which is at the same level as BuildResources. If there is another way to do this easier, please let me know. I haven't yet found a way to just extract C:\workspaces\antbuild\stephen and then append /Server to the end of it. Is there a default environment variable? This is in XML ant.

Was it helpful?

Solution

you should try with :

<property name="configDir" location="../Server"/>

from the Ant Manual property task :

Sets the property to the absolute filename of the given file. If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions). Otherwise it is taken as a path relative to the project's basedir and expanded.

Rule of thumb => when dealing with path use location attribute, otherwise value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top