Orangevolt ANT Tasks » Tasks » find
findcompare

2.6.1.  Example

Suppose you want to use the a library file (my-custom-tasks-*.jar) which contains version and build informations and don't want to modify the build file everytime you use a new version of it.

build.xml
<?xml version="1.0"?>  
 
<project basedir="." name="properties-test" default="main">
  <taskdef classpath="orangevolt-ant-tasks-1.3.2.jar" resource="com/orangevolt/tools/ant/taskdefs.properties"/>
  <target name="main">
      <!--
        find the jar file and put its name
        into property "custom-tasks-jarfile"
      -->
    <find dir="lib"
          file="my-custom-tasks-*.jar"
          nameProperty="custom-tasks-jarfile"
    />
      <!--
        use the jar file name
        to load the tasks and taskdefs
      -->
    <taskdef resource="custom/tasks/taskdefs.properties">
      <classpath>
        <pathelement path="."/>
        <pathelement location="lib/${custom-tasks-jarfile}"/>
      </classpath>
    </taskdef>
  </target>
</project>