Attributes of Ant getting started tutorials and ant getting started tutorials
1. Compile a simple Build File Ant. The build files are all written in XML. Each build file contains one project and at least one (default) target.
Target contains some task elements. Each task element can have an id attribute that can be referenced.
2. Project
A project has the following attributes ):
1. name attribute
Specifies the name of the project element.
2. default attributes
Name of the target to be executed by default when no target is provided
3. basedir attributes
Specifies the location of the base path. When this attribute is not specified, the parent directory of the Ant component file is used as the reference directory.
Each project defines one or more targets. A target is a group of tasks to be executed.
When you start running ant, you can select which task group is executed. If no target is set, the default value of the project is executed.
Iii. Target
Target may depend on other targets. You may use one target for compilation, another target for deployment.
The deployment can be executed only after the compilation is complete, so that the deployment depends on the compilation. It should be noted that ant's depends attribute only specifies
It does not indicate true dependency. The order of dependencies is arranged from left to right.
However, if there are dependencies between these dependencies, they may also be executed later.
1. name attribute
Specifies the name of the target element. This attribute is unique in a project element. You can specify a target by specifying the target element name.
2. depends attributes
Describes the dependencies between targets. If there is a dependency between multiple targets, it must be separated. Ant will follow the target
Each target is executed in sequence. The target to be depended on will be executed first.
3. if attributes
Used to verify whether the specified property exists. If it does not exist, the target will not be executed.
4. unless attributes
This property is opposite to the if property. It is also used to verify whether the specified property exists. if it does not exist, the target of the property will be executed.
5. description attributes
This attribute is a brief description and description of the target function.
The following columns:
<target name="A"/><target name="B" depends="A"/><target name="C" depends="B"/><target name="D" depends="C,B,A"/>
The execution sequence is as follows: A --> B --> C --> D
Iv. property
Property is similar to a variable and can be used by other elements in build. xml. The property of a project can be set through the property element.
Ant provides some built-in attributes
Basedir project absolute path
Absolute path of the ant. file Build file
Ant. version Ant version
Ant. project. name the name of the project currently being executed
Ant. project. default-target the default target name of the project currently being executed
Absolute path of ant. core. lib file ant. jar
Ant. home Ant root directory
Author: itmyhome
Original article: wheat field technical blog