Introduction to Apache Ant
        
        
          The Apache Ant package is a
          Java-based build tool. In theory,
          it is like the make
          command, but without make's wrinkles. Ant is different. Instead of a model that is
          extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell
          commands, the configuration files are XML-based, calling out a
          target tree that executes various tasks. Each task is run by an
          object that implements a particular task interface.
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            Development versions of BLFS may not build or run some packages
            properly if LFS or dependencies have been updated since the most
            recent stable versions of the books.
          
         
        
          Package Information
        
        
        
          Apache Ant Dependencies
        
        
          Required
        
        
          A JDK (Java Binary or OpenJDK-24.0.2) and
          GLib-2.86.1
        
        
          ![[Note]](../images/note.png) 
          
            Note
          
          
            An Internet connection is needed for building this package. The
            system certificate store may need to be set up with make-ca-1.16.1 before building this package.
          
         
       
      
        
          Installation of Apache Ant
        
        
          Build a limited bootstrap version of Apache Ant using the following command:
        
        ./bootstrap.sh
        
          Download the runtime dependencies using the fetch.xml ant build script:
        
        bootstrap/bin/ant -f fetch.xml -Ddest=optional
        
          Build Apache Ant by running the
          following command:
        
        ./build.sh -Ddist.dir=$PWD/ant-1.10.15 dist
        
          Install, as the root user:
        
        cp -rv ant-1.10.15 /opt/            &&
chown -R root:root /opt/ant-1.10.15 &&
ln -sfv ant-1.10.15 /opt/ant
       
      
        
          Command Explanations
        
        
          bootstrap/bin/ant -f fetch.xml
          -Ddest=optional: Downloads the missing dependencies
          to the user's home directory, and copies them into the source tree
          (in the lib/optional directory, where
          ant picks them up at
          build time).
        
        
          ./build.sh
          -Ddist.dir=$PWD/ant-1.10.15 dist: This command
          builds, tests, then installs the package into a temporary
          directory.
        
       
      
        
          Configuring Apache Ant
        
        
          
            Config
            Files
          
          
            /etc/ant/ant.conf, ~/.ant/ant.conf, and ~/.antrc
          
         
        
          
            Configuration Information
          
          
            Some packages will require ant to be in the search path
            and the ANT_HOME environment variable
            defined. Satisfy these requirements by issuing, as the
            root user:
          
          cat > /etc/profile.d/ant.sh << EOF
# Begin /etc/profile.d/ant.sh
pathappend /opt/ant/bin
export ANT_HOME=/opt/ant
# End /etc/profile.d/ant.sh
EOF
          
            The above instructions assume you have configured your system as
            described in The Bash Shell Startup
            Files.
          
         
       
      
        
          Contents
        
        
          
            
              Installed Programs:
              ant, antRun, antRun.pl,
              complete-ant-cmd.pl, runant.pl, and runant.py
            
            
              Installed Libraries:
              Numerous ant*.jar and dependent libraries in
              $ANT_HOME/lib
            
            
              Installed Directories:
              /opt/ant-1.10.15
            
           
         
        
          
            Short Descriptions
          
          
            
              
              
            
            
              
                | 
                    ant
                   | 
                    is a Java based build
                    tool used by many packages instead of the conventional
                    make
                    program
                   | 
              
                | 
                    antRun
                   | 
                    is a support script used to start ant build scripts in a
                    given directory
                   | 
              
                | 
                    antRun.pl
                   | 
                    is a Perl script that
                    provides similar functionality offered by the
                    antRun
                    script
                   | 
              
                | 
                    complete-ant-cmd.pl
                   | 
                    is a Perl script that
                    allows Bash to complete
                    an ant
                    command-line
                   | 
              
                | 
                    runant.pl
                   | 
                    is a Perl wrapper script
                    used to invoke ant
                   | 
              
                | 
                    runant.py
                   | 
                    is a Python wrapper
                    script used to invoke ant
                   | 
              
                | 
                    ant*.jar | 
                    files are the Apache Ant
                    Java class libraries
                   |