Ant

Jakarta

Download

Get Involved

Questions
Installation
Advanced issues
Answers
I get checksum errors when I try to extract the tar.gz distribution file. Why?

Ant's distibution contains file names that are longer than 100 characters, which is not supported by the standard tar file format. Several different implementations of tar use different and incompatible ways to work around this restriction.

Ant's <tar> task can create tar archives that use the GNU tar extension, and this has been used when putting together the distribution. If you are using a different version of tar (for example, the one shipping with Solaris), you cannot use it to extract the archive.

The solution is to either install GNU tar, which can be found here or use the zip archive instead (you can extract it using jar xf).

How do I include an XML snippet in my build file?

You can use XML's way of including external files and let the parser do the job for Ant:

<?xml version="1.0"?>

<!DOCTYPE project [
    <!ENTITY common SYSTEM "file:./common.xml">
]>

<project name="test" default="test" basedir=".">

  <target name="setup">
    ...
  </target>

  &common;

  ...

</project>

will literally include the contents of common.xml where you've placed the &common; entity.

In combination with a DTD, this would look like this:

<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "file:./ant.dtd" [
   <!ENTITY include SYSTEM "file:./header.xml">
]>

Copyright © 1999-2001, Apache Software Foundation