It mainly describes the functions of each attribute in ant. The most common attributes currently include Delete, target, mkdir, copy, jar, and project.
1. <project>
This attribute is the root attribute of the build file. It can have multiple internal attributes. Their meanings are as follows:
Default indicates the default running target. This attribute is required.
Basedir indicates the reference directory of the project.
Name indicates the project name.
Description indicates the description of the project.
2. <target>
. Name indicates the target name. This attribute is required.
. Depends indicates the target of the dependency.
If indicates that it is executed only when the attribute is set.
Unless indicates that the task is executed only when the attribute is not set.
Description indicates the description of the project.
The depends attribute of ant specifies the execution sequence of the target. Ant will execute each target in sequence according to the Appearance Order of the target in the depends attribute. Before execution, you must first execute the target on which it depends.
3. <mkdir>
Creates a directory with the Dir attribute to specify the name of the Created directory.
4. <jar>
This attribute is used to generate a jar file. Its Attributes are as follows.
Destfile indicates the JAR file name to be generated.
Basedir indicates the file name to be archived.
Schemdes indicates the file mode to be archived.
Exchudes indicates the excluded file mode.
5. <javac>
This attribute is used to compile one or more java files. Its Attributes are as follows.
Srcdir indicates the sourceProgramDirectory.
Destdir indicates the output directory of the class file.
Include indicates the mode of the compiled file.
Excludes indicates the mode of excluded files.
Classpath indicates the class path used.
Debug indicates the debugging information.
Optimize indicates whether optimization is used.
Verbose indicates providing detailed output information.
Fileonerror indicates that it is automatically stopped when an error occurs.
6. <Java>
This attribute is used to execute the compiled. Class file. Its Attributes are as follows.
Classname indicates the name of the class to be executed.
Jar indicates the JAR file name containing the class.
Classpath indicates the class path used.
Fork indicates that the class is run in a new virtual machine.
Failonerror indicates that it is automatically stopped when an error occurs.
Output indicates the output file.
Append indicates appending or overwriting the default file.
7. <Delete>
This attribute is used to delete a file or a group of files. Its Attributes are as follows.
File indicates the file to be deleted.
Dir indicates the directory to be deleted.
Includeemptydirs indicates whether to delete an empty directory. The default value is Delete.
Failonerror indicates whether to stop an error. The default value is automatic stop.
8. <copy>
This attribute is used to copy a file or file set. Its Attributes are as follows.
File indicates the source file.
Tofile indicates the target file.
Todir indicates the target directory.
Overwrite indicates whether to overwrite the target file. The default value is not overwrite.
Includeemptydirs indicates whether to copy an empty directory. The default value is copy.
Failonerror indicates whether to stop automatically if the target is not found. The default value is stop.