CentOS7 installation and configuration Ant

1. Download Ant from the official website

1. Find Download - Binary Distributions on the left menu of the official website

2. Download the ant package, I downloaded: apache-ant-1.9.7-bin.tar.gz


2. Decompression

[plain]  view plain copy  
  1. [arthur @ arthur ~] $ tar -zxvf apache-ant-1.9.7-bin.tar.gz  

3. Mobile directory (optional)

Since my applications are all placed in the opt directory, I moved ant to the opt directory and changed the directory name to ant

[plain]  view plain copy  
  1. [arthur@arthur ~]$ mv /home/user/Downloads/apache-ant-1.9.7 /opt/ant  

Fourth, set environment variables

[plain]  view plain copy  
  1. // open configuration file  
  2. [arthur@arthur ~]$ vim /etc/profile  
  3.   
  4. // Add the ant environment at the end of the file  
  5. export ANT_HOME=/opt/ant  
  6.   
  7. // and add the ant environment to the path ("$ANT_HOME/bin:")  
  8. export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH  
  9.   
  10. // save and exit  
  11. :wq!  

Five, forced to update the configuration file

[plain]  view plain copy  
  1. [arthur@arthur ~]$ source /etc/profile  

6. Test

[plain]  view plain copy  
  1. [arthur@arthur ~]$ ant -version  
  2.   
  3. // If the following prompt appears, the configuration is successful  
  4. Apache Ant(TM) version 1.9.7 compiled on April 9 2016  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325678151&siteId=291194637