Hello Everyone,
Today I am going to explain that how to
install ANT on Mac OS in few easy steps. Apache
Ant is Java library and command line tool used to “build” or run tasks. It’s
pretty popular in the Java Community along with Maven. I don’t typically use
Ant in our day to day build process for projects but we recently
became involved in a project that does require it. The use of ant i am going to do in my angular js project. I am using vscode, Before we start the process, Please
open a new Terminal window.
Step
1. Check If ANT
is already installed. Type command $ ant on the terminal and hit enter. If command not found
means ANT is not installed on the system.
Step
2. Download ANT
from internet. You can reach to ANT download page by click here and download apache-ant-****-bin.zip file
& Place it in home directory.
You
can rename folder to any name.
Step
3: We need to add ant to
our path within our .bash_profile so it can run by simply using the “ant”
command within terminal.If you are like me. You may not have had a
“.bash_profile” file. We can create a
.bash_profile from terminal as well. Below we create a new bash profile
and also open it in text edit with 2 simple commands. Type $ open -e .bash_profile in
terminal. This will open .bash_profile in editor. If .bash_profile is never created,
then use command $ touch .bash_profile to create profile. Commands are given below.
touch
~/.bash_profile
open
-e ~/.bash_profile
With our new .bash_profile
file open. Let’s add in our Apache Ant path. This is an important step so we
can call our ant command in terminal easily. If you recall from previous steps
we extracted Ant and renamed the folder to “ant” we then moved the ant folder
into our user home directory. If you still have terminal open we can easily get
the full path for our ant folder.If you aren’t familiar with linux terminal
commands. It can be a bit concerning if you see something like “pwd” at first
in a command. Don’t worry this command simply means “print working directory”
after we’ve change the directory we’re working in.
Step
4: Give the
path to Ant bin folder. Use :{path to ant bin folder}.
export
PATH=$PATH:/Users/systemname/apache-maven-3.5.3/bin:/Users/systemname/ant/bin
Save
and exit.
Step
5: Type below commands on terminal to execute the .bash_profile. it is very simple, just follow the given commands.
$ cd
~
to navigate to home directory.
. .bash_profile to execute update on bash profile.
Step
6: Type $ ant in terminal again. If output says build.xml does not exist! Means
you have ant installed successfully.
Step
7: if you have
brew installed on system then you can type command $ brew install ant . As mentioned if brew is installed, No need to follow any of the above steps. just type the command.
$ brew install ant
This command will download ant on the mac using terminal and it
will install Ant on Mac successfully.
Happy
Coding!! Thank you!!
Please leave a comment/question if you above steps are not working for you.
Please leave a comment/question if you above steps are not working for you.
No comments:
Post a Comment