| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Ant example source code file (untar.xml)

This example Ant source code file (untar.xml) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Ant tags/keywords

The untar.xml source code

<?xml version="1.0"?>

<project basedir="." default="cleanup">

  <target name="cleanup">
    <delete file="asf-logo.gif" />
    <delete file="untartest.tar" />
    <delete dir="untartestin"/>
    <delete dir="untartestout"/>

  <target name="testTarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar" dest="." />
    <ant antfile="tar.xml" target="cleanup" />

  <target name="testGzipTarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar.gz" dest="." compression="gzip" />
    <ant antfile="tar.xml" target="cleanup" />

  <target name="testBzip2TarTask">
    <ant antfile="tar.xml" target="feather" />
    <untar src="asf-logo.gif.tar.bz2" dest="." compression="bzip2"/>
    <ant antfile="tar.xml" target="cleanup" />

  <target name="realTest">
    <untar src="expected/asf-logo.gif.tar" dest="." />

  <target name="realGzipTest">
    <untar src="expected/asf-logo.gif.tar.gz" dest="." compression="gzip" />

  <target name="realBzip2Test">
    <untar src="expected/asf-logo.gif.tar.bz2" dest="." compression="bzip2"/>

  <target name="srcDirTest">
    <untar src="." dest="." />

  <target name="encoding">
    <untar src="expected/asf-logo.gif.tar" dest="." encoding="foo"/>

  <target name="resourceCollection">
    <mkdir dir="untartestout"/>
    <zip destfile="untartestout/">
      <fileset dir="expected">
        <include name="asf-logo.gif.tar"/>
    <untar dest=".">
      <zipfileset src="untartestout/">
        <include name="*.tar"/>

  <target name="prepareTestTar">
    <mkdir dir="untartestin/1"/>
    <mkdir dir="untartestin/2"/>
    <touch file="untartestin/1/foo"/>
    <touch file="untartestin/2/bar"/>
    <copy todir="untartestin/2">
      <fileset dir="expected" includes="*md5*"/>
    <tar destfile="untartest.tar" basedir="untartestin"/>

  <target name="testDocumentationClaimsOnCopy" depends="prepareTestTar">
    <copy todir="untartestout" preservelastmodified="true"> 
      <tarfileset src="untartest.tar">
          <include name="2/"/>

Other Ant examples (source code examples)

Here is a short list of links related to this Ant untar.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.