Showing posts with label Java ANT - How to call "ANT Build" target's without using 'depends' attribute. Show all posts
Showing posts with label Java ANT - How to call "ANT Build" target's without using 'depends' attribute. Show all posts

Sunday, 20 July 2014

How to call "ANT Build" target's without using 'depends' attribute.

1. Below is the 'Sample XML' for calling ANT targets without using 'depends' attribute.
> Use 'antcall' for calling the target's.

Sample XML file : ANTCall.xml 
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
   <target name="info">
      <echo>Calling the targest</echo>
 <antcall target="target1" />
 <antcall target="target2" />
   </target>
 
   <target name="target1">
      <echo>TARGET 1....</echo>
   </target>

   <target name="target2">
      <echo>TARGET 2....</echo>
   </target>  
</project>

Output:


2. Below sample xml for calling ANT targets using 'depends' attribute.

Sample XML file : DependsAttr.xml 
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
   <target name="info" depends="target1,target2">
      <echo>Calling the targest completed</echo>
   </target>
 
   <target name="target1">
      <echo>TARGET 1....</echo>
   </target>

   <target name="target2">
      <echo>TARGET 2....</echo>
   </target>
</project>

Output: