I am working on some project using Apache Ant and my project layout is as follows:
project/build.xml
project/properties/build.properties
project/tool/antcontrib.jar
Here, when i run ant command it working fine and my base directory is basedir="."
Now, I want my project layout to be as follows:
project/folder/build.xml
project/properties/build.properties
project/tool/antcontrib.jar
Now, I changed my base directory to basedir="..". I thought it might work. but still it's not working. So i wan't to known what we have to set our basedir for '../' Here is the code block related to taskdef defined in my build.xml file.
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${tool.ant.contrib}"/>
</classpath>
</taskdef>
NOTE: I known that build.xml and properties file should be in same folder its a standard practice. But i don't want to follow that..can any one help me out here...
In order to work, the property tool.ant.contrib
should be a relative path, not an absolute one.
For instance, this piece of build works:
<project basedir="..">
<property name="tool.ant.contrib" location="tool/antcontrib.jar" />
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${tool.ant.contrib}"/>
</classpath>
</taskdef>
<if><isset property="tool.ant.contrib" />
<then><echo message="OK" /></then>
</if>
</project>
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