Skip to content

Installing Apache Ant

Toberumono edited this page Aug 24, 2015 · 1 revision

Installing Ant can be a bit annoying if you do not have a package manager (e.g. Apt, Yum, Homebrew, etc.). This guide aims to walk you through the setup process.

#A Few Quick Notes

  1. This guide does not require sudo (assuming you already have wget installed. That requires sudo).
  2. This guide assumes you are comfortable with the following commands:
  3. None, actually - this guide is really short.
  4. This guide uses the following programs:
  5. A modern shell (The thing that Terminal uses)
  6. wget * If you do not have it, sudo apt-get install wget or sudo yum install wget should do the trick.
  7. That's it
  8. Ant will be installed in a folder called .ant in your home directory.
    Use ls -lh $HOME/.ant to see what is in it.

#Walkthrough

  1. Run:

    bash <(wget -qO - https://raw.githubusercontent.com/Toberumono/Miscellaneous/master/ant/automatic_install.sh)
  2. Restart Terminal

  3. All done!

#Excessive Detail This section contains extra details that aren't important to the Walkthrough, or, well, any part of this page, really, but might be interesting at some level.

##So, what does the only command in this whole thing do?

  1. Uses a pattern in the Ant release notes to grab the most recent version number
  2. Determines whether the current version of Ant (if it exists) needs to be updated
  • If it does not, it prints a message to that effect and then exits.
  1. Downloads the tarball for the newest version and unpacks it into a versioned subfolder in the .ant directory.
  2. Updates the ~/.ant/current symlink
  3. Calls append_paths.sh to append the appropriate paths to the user's bash profile.

##Okay, what does the append_paths.sh script do? This script just adds the necessary export commands the user's appropriate shell profile file.
Specifically, it adds:

  1. export PATH="$HOME/.ant/current/bin:$PATH"

It detects the correct profile file and adds the paths using the get_profile.sh and update_rc.sh scripts in the common section of this repository. You can see more information on them here: https://github.com/Toberumono/Miscellaneous/tree/master/common