Ant installation, environment variable configuration and Verification

Source: Internet
Author: User
1. Install ant

Go to the official homepage http://ant.apache.org to download the new version (currently ant1.8.1release of ant, get a compressed package of apache-ant-1.8.1-bin.zip. Decompress it to your hard disk, for example, C: \ apache-ant-1.8.1.

2. Configure Environment Variables

Set ant environment variables in window:

Ant_home C:/Apache-ant-1.8.1

Path C:/Apache-ant-1.8.1/bin

Classpath C:/Apache-ant-1.8.1/lib

Note :【Configure environment variables: My computer ---- properties ----- advanced ---- Environment Variables
For example, ant_home: C: \ apache-ant-1.8.1
Path: % ant_home % \ bin (to facilitate operations in the DOS environment)The experiment always fails and cannot be changed to address C:/Apache-ant-1.8.1/bin without using variables... Yes ..]

3. Verify ant

To verify whether ant is successfully installed, perform the following operations:

Select Start> RUN> cmd, and enter the following command: ant

If the following content appears, the installation is successful:

Buildfile: Build. XML does not exist!

Build failed

[This indicates that ant has been installed successfully! Because ant runs the build. xml file by default, this file needs to be created .]

View version: ant-version

If the following content appears, the installation fails: (you can repeat the preceding steps until the installation is successful .)

'Ant'It is neither an internal or external command, nor an executableProgramOr batch files.

 

Move from somewhere else:

Usage:
(1) Create build. xml under the root directory of drive d

1 <? XML version = "1.0" encoding = "GBK" ?>
2 < Project Name = "Test script" Default = "Copyfile" Basedir = "."   >
3 < Target Name = "Copyfile" >
4 < Copy File = "D:/a.txt" Todir = "E:/Temp" Overwrite = "True"   />
5 </ Target >
6 </ Project >

(2) Create the.txt file under the ddisk root directory.
(3) Go to dos.
D:
ant
the aa.txt file can be found in the E:/tempdirectory. The file contains the same content as a.txt, which means the copy is successful!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.