Run the ant script (reprint)

Source: Internet
Author: User

http://blog.csdn.net/linwei_1029/article/details/5809801steps to run an ant script

1. Right-click My Computer--"Properties--" advanced--"environment variable--" administator User variable--"new (variable named ant_home, variable value is e:/java/ant/ apache-ant-1.6.5, that is, ant's installation root, not to bin)

2. Add a line to the path of the system variable%ant_home%/bin "= =" E:/java/ant/apache-ant-1.6.5/bin

3. Enter CMD in the run, then enter the cmd command line, and if the following statement appears, the ant installation is successful
Buildfile:build.xml does not exist!
Build failed

Example Description: * * * *
1. Create a build.xml in d:/that contains
<?xml version= "1.0" encoding= "GBK"?>
<project name= "test Script" default= "CopyFile" basedir= "." >
<target name= "CopyFile" >
<copy file= "D:/a.txt" todir= "C:/temp" overwrite= "true"/>
</target>
</project>

2. Create a a.txt in the same level directory

3. Go to cmd, use D: Enter the appropriate directory, and then enter Ant, if successful you can see data such as the following
Buildfile:build.xml

CopyFile
[Copy] Copying 1 file to C:/temp

BUILD Successful
Total time:0 seconds

4. Finally, in c:/, you can see that a temp directory was generated, and then there is a a.txt file

Attention:
1. Naming the build script
The default name is Build.xml, if your build script name is Build.xml, then you can run the ant command directly, if it is another name, such as: Mybuild.xml, then your command line should be changed to: Ant–f Mybuild.xml.

2. Run a specific task?
Run: Ant CopyFile, which will run the target named CopyFile.

Run the ant script (reprint)

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.