With the recent intention of using Ant in Eclipse Engineering, it is still good to discover ant tools.
It's much more flexible than eclipse.
A detailed description of the XML configuration.
----------------------------------------------------The following are specific documents-------------------------------------------
<!--Ant (another neat tools---another neat tool)--
<?xml version= "1.0"?>
<project default= "Dist" name= "Project A" >
<description>
A descriptive message that has no practical effect.
</description>
<!--property element is equivalent to a variable, holding a certain value, once given cannot be changed, only through the console command line to the initial value.
It is generally assigned value with value, where location is used instead of value because the Location property is specifically set
Contains the file system path, which is the current path, in a platform-independent manner. -
<property name= "Srcdir" location= "." />
<property name= "BuildDir" location= "Classes"/>
<property name= "Distdir" location= "dist"/>
<!--a target element is a task, a step, and if the command line does not specify a start task, the task to perform is determined by the project element's default property--
<target name= "Init" description= "Specifies the description information in the element. ">
<echo message= "The information here will be output to the console. ">
<!--tstamp elements generally do not define attributes and content and do not produce any output; instead, it sets the Ant following properties based on the current system time and date:
Attribute Description Example
Dstamp is set to the current date, the default format is YYYYMMDD 20031217
Tstamp is set to the current time, the default format is HHMM 1603
Today is set to the current date, with the full month of December 17, 2003--
<tstamp/>
<!--mkdir element is used to create a directory dir property to specify the directory path--
<!--delete element is used to delete directory ${builddir} Reference property element specifies the attribute variable named BuildDir--
<mkdir dir= "${builddir}"/>
<mkdir dir= "${distdir}"/>
<!--file operations:
<copy file= "Src/test.java" tofile= "Src/testcopy.java"/> Copy a file Test.java copies Testcopy.java
<move file= "Src/test.java" tofile= "Src/testcopy.java"/> Rename file Test.java to Testcopy.java
<copy file= "Src/test.java" todir= "archive"/> Copy file Test.java from src directory to archive directory
<move file= "Src/test.java" todir= "archive"/> Move file Test.java from src directory to archive directory
<replace file= "Input.txt" token= "old" value= "new"/>replace task, which performs the find and replace operations in the file.
The token property specifies the string to find,
The Value property specifies a new string,
All instances of the found token string are replaced with this new string.
The replace operation will be performed in the appropriate place within the file itself. To provide more detailed output, you can set the summary property to
True This causes the task output to find and replace the number of token string instances.
<copy todir= "Archive" >---Copying multiple files using pattern matching
<fileset dir= "src" >--fileset instead of the file attribute
<include name= "*.java"/>--contains all the *.java files in the SRC directory
<exclude name= "*.class"/>--does not contain all the *.class files in the SRC directory
</fileset>
</copy>-->
</target>
<!--the depends property of the target element is used to set a dependency between multiple target elements, and if you want to perform a task, you must first perform all the depends properties specified by the
It relies on the target element, and only if all the target elements it relies on are executed to execute it itself--
<target name= "com" depends= "init" >
<!--the Javac element compiles all *.java files in the Srcdir specified directory into *.class files to the directory specified by Destdir.
If you do not specify the Destdir property, it is compiled to the same directory by default. Other properties:
Classpath: The-classpath option equivalent to Javac.
Debug= "true": instructs the compiler to compile the source file with debug information.
Fork= "true": when you want to specify some memory options for the compiler, or when you need to use a different level of compiler. This property is set to "true"
Executable= "D:sdk141injavac": Specifies a different javac executable file.
Memorymaximumsize= "128m": Pass a maximum memory setting to the Javac specified above--
<javac srcdir= "${srcdir}" destdir= "${builddir}"/>
</target>
<target name= "dist" depends= "com" >
<!--jar elements: After compiling the Java source file, the resulting class file is usually packaged into a jar file that resembles a zip archive
Thing Each jar file contains a manifest file that can specify the properties of the jar file.
You can also package all content in the directory as a WAR file
DestFile: Full file name after packaging
Basedir: File path to package--
<jar destfile= "${distdir}/package-${dstamp}.jar" basedir= "${builddir}" >
<!--The Manifest property allows you to specify a file to use as a manifest for the JAR file. The contents of the manifest file can also be used manifest
The task is specified in the build file. This task can write to a manifest file like a file system, or it can actually be nested in the jar's
In order to create the manifest file and JAR text at once