In this tutorial, we will learn steps involved to Download and Install Ant on Windows 10 operating system. The steps would be same for older versions like Windows 7.
Navigate to the Ant Download page. Pick a suitable distribution based on the Java version.
Ant tool is distributed as .zip and tar.gz archives. The .zip archive file is for Windows operating system. Download the .zip archive file on to the computer.
Install Ant on Windows
Locate the .zip archive file. Extract the contents of the zip file. Right click on the file and choose Extract All… menu option.
Optionally, we can rename and copy the folder to standard location like C:, so that the tool can be accessed at ‘C:\ant’.
Create ANT_HOME variable
Create an environment variable and set the Ant folder path location to the variable. For example, set the ANT_HOME environment variable to:
ANT_HOME to C:\ant
Steps to setup environment variable on Windows:
Append bin folder to the PATH variable
Append ANT_HOME\bin folder to the PATH environment variable. For example, C:\ant\bin
The batch scripts in the Ant bin directory use this environment variable to know where the Ant is installed on the machine.
Lunch command prompt and issue the following command. Successful install would display the ant version information on the console window. If we add the Ant bin directory to the PATH variable, we can run this command from anywhere in the command prompt. There is no need to change directory path to that of the Ant bin folder!
\> ant -v
The default Ant build file name is build.xml
That’s it. We are done with Ant installation on Windows OS.