Original Ant code issue

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 the Ant command, it works fine, and my base directory is based on = "."

Now I want my project layout to be as follows:

 project/folder/build.xml project/properties/build.properties project/tool/antcontrib.jar 

Now I have changed the base directory to basedir = "..". I thought it might work. but still it does not work. Therefore, I do not know what we should install for our founders for '../' Here is a block of code associated with the taskdef defined in the build.xml file.

 <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> <pathelement location="${tool.ant.contrib}"/> </classpath> </taskdef> 

NOTE. I knew that the build.xml and properties file should be in the same folder as standard practice. But I do not want to keep track of this. If anyone helps me here ...

+6
source share
1 answer

To work, the tool.ant.contrib property must be a relative path, not an absolute one.

For example, this piece of assembly 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> 
+1
source

Source: https://habr.com/ru/post/945121/


All Articles