Target based on condition : Condition « Ant « Java






Target based on condition

<?xml version="1.0"?>

<project name="Apache Ant Properties Project" default="do-windows" basedir=".">

  <condition property="is.windows">
    <os family="windows"/>
  </condition>

  <condition property="is.unix">
    <os family="unix"/>
  </condition>

  <target name="do-windows" if="is.windows">
    <echo message="This is Windows"/>
  </target>

  <target name="do-unix" if="is.unix">
    <echo message="This is Unix"/>
  </target>


</project>

           
       








AntBasicTags.zip( 2 k)

Related examples in the same category

1.Specify condition
2.Condition for file change