Sunday, August 15, 2010

How to install apache ant on linux server?

Guys,

what is Apache ant ?

Apache Ant is a software tool for automating software build processes. It is similar to Make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects.

I followed following steps :

Login into the server via SSH :
====
1. wget http://apache.mirrors.tds.net/ant/binaries/apache-ant-1.8.1-bin.tar.gz
2. tar -xzvf apache-ant-1.8.1-bin.tar.gz
3. cd apache-ant-1.8.1
4. cp -arp * /usr/local/ant
5. echo 'export PATH=$PATH:/usr/local/ant/bin'>>/etc/profile
6. echo 'export ANT_HOME=/usr/local/ant'>>/etc/profile
7. export PATH=$PATH:/usr/local/ant/bin
8. export ANT_HOME=/usr/local/ant
====

Now, execute ant -v or ant --version to check the ant.

That's it. try :)

9 comments:

  1. hey

    4. cp -arp * /usr/local/ant isn't working?

    Not sure why not

    Lance

    ReplyDelete
  2. Could you please let me the error that you got?

    Did you create the path like: mkdir -p /usr/local/ant

    ReplyDelete
  3. When i do a ant -v

    I get the following - build.xml does not exist

    Apache Ant(TM) version 1.8.2 compiled on December 20 2010
    Trying the default build file: build.xml
    Buildfile: build.xml does not exist!
    Build failed

    ReplyDelete
  4. Ok i got this from the ant site - thx for this tutorial!!

    You can check the basic installation with opening a new shell and typing ant. You should get a message like this

    Buildfile: build.xml does not exist!
    Build failed
    So Ant works. This message is there because you need to write an individual buildfile for your project. With a ant -version you should get an output like
    Apache Ant version 1.7.1 compiled on June 27 2008

    ReplyDelete
  5. i also get same error.

    Apache Ant(TM) version 1.8.2 compiled on December 20 2010
    Trying the default build file: build.xml
    Buildfile: build.xml does not exist!
    Build failed

    how to fix this. please help me

    ReplyDelete
  6. This is not an error the message says that in the current directory does not exist build.xml file, if you like add ANT_HOME to system path you can add to profile file, of this way http://moeandjava.pusku.com/index.php/java/how-to-install-ant-on-linux

    ReplyDelete
  7. i am a beginner in linux. i want to install apache webserver.. as i did the above steps i got an error like this.

    root@iot2000:~# cd apache-ant-1.8.1
    root@iot2000:~/apache-ant-1.8.1# cp -arp * /usr/local/ant
    cp: target '/usr/local/ant' is not a directory
    root@iot2000:~/apache-ant-1.8.1# mkdir -p /usr/local/ant
    root@iot2000:~/apache-ant-1.8.1# cp -arp * /usr/local/ant
    root@iot2000:~/apache-ant-1.8.1# echo 'export PATH=$PATH:/usr/local/ant/bin'>>/etc/profile
    root@iot2000:~/apache-ant-1.8.1# echo 'export ANT_HOME=/usr/local/ant'>>/etc/profile
    root@iot2000:~/apache-ant-1.8.1# export PATH=$PATH:/usr/local/ant/bin
    root@iot2000:~/apache-ant-1.8.1# export ANT_HOME=/usr/local/ant
    root@iot2000:~/apache-ant-1.8.1# ant -v
    -sh: ant: command not found

    can someone help me to solve this. what is went wrong

    ReplyDelete
    Replies
    1. can anyone explain what is PATH and ANT_HOME

      Delete