We are currently changing our infrastructure to use the distributed hadoop filesystem (HDFS, an open source filesystem similar to Google’s), instead of dedicated fileservers. Therefore we needed to change the ant task that deletes old files on the developer’s computers to delete those files in HDFS. After some extensive research – “ant hadoop” are really bad search terms – we found that the Hadoop distribution already comes with some predefined tasks. This is how they can be used:
-
<path id="ant.classpath">
-
<fileset dir="${libs.dir}">
-
<include name="hadoop-0.18.3-ant.jar" />
-
<include name="hadoop-0.18.3-core.jar" />
-
<include name="commons-cli-2.0-SNAPSHOT.jar" />
-
</fileset>
-
</path>
-
<taskdef name="hdfs" classname="org.apache.hadoop.ant.DfsTask" classpathref="ant.classpath" />
-
<target name="createHDFSdirectory">
-
<hdfs cmd="mkdir" args="hdfs://localhost:54310/testDir" />
-
</target>
-
<target name="deleteHDFSdirectory">
-
<hdfs cmd="rmr" args="hdfs://localhost:54310/testDir" />
-
</target>