Click here to download startwithant full PDF document and code: http://download.csdn.net/detail/sodino/6603769
Ant, a tool that links software compilation, testing, deployment, and other steps together to automate software development in Java environments.
I use Ant's scene is to take it in the background to compile, packaging Android project operations, during ant work, still can use ecelipse, avoid painful waiting.
Before using it, you should download ant and deploy the execution environment, which is the process of adding system environment variables in detail, as follows: Ant installation, environment variable configuration and validation.
An example of ant is given below:
[HTML] view plain copy <?xml version= "1.0" encoding= "UTF-8"?> <project name= "Hello_world" default= "Ec Ho "basedir=". " > <target name= "Echo" description= "Just print ' Hello world '." > <echo message= "Hello world! I ' m ant. " ></echo> </target> </project> Code 1.1 Hello World
Ant does not define its own syntax, and its executable file is written in XML.
The above code is stored in the file build_01_hello_world.xml. Executing the file requires the following command:
Ant–f Build_01_hello_world.xml, the operation effect is as follows:
Figure 1.1 Hello World
After executing the command, the first line shows the absolute path of the compiled file, and the "Echo:" After a space line indicates that the target name of the current execution is "echo"; [Echo] "indicates that the current output was initiated by the Ant's Echo Task (Task). Finally, the prompt for "BUILD successful" and the amount of time spent executing are given.
An easier way to execute the ant build file is to name the build file Build.xml, which can be run as long as the command line ant is executed in the same directory as the build file.