Automatically build test backups and post to project web (1)
Ant is a very good Java compilation tool. The author said that this thing is Make tool without Make defects (Linux / UNIX users should be very familiar with make / makefile), here we come to specific practice to use Ant to build project build management.
At the beginning of the article, I didn't have a common case, and I briefly introduced Ant. Ant is a Java's basic build tool (I use this word here because I think it is only some of the small part of the compilation only for Ant. Ant is developed using Java, but not just a functionality that only provides only the Java tool, but also provides the functionality of other languages, just like other Make tools. And because Java is a cross-platform, Ant is also used across platform, and the real implementation of Java is running everywhere. The current Ant has launched a 1.54 version, and this version requires support for JDK1.1 or later. However, I have no specific test. I can't easily find JDK1.1. No one will develop this low version of JDK, especially in China.
Ant needs users to write a build script to manage projects. This script is a document in XML format (recently very popular using XML document, at least the configuration file of the Java project on Apache.org I see is XML format, it seems that we are also advancing with the times). You can write such a build script using any of your favorite editor. If you want to be written by the notebook that you can bring, no one will oppose. I am using Eclipse here. Choosing him is because Eclipse itself has integrated Ant 1.5.3 version (as a plugin for Eclipse), it can be used, and integrated an ANT editor, you can do code prompts, the most important reason is me The project is developed with Eclipse, so Eclipse is the choice.
In EclPise, you don't need to configure Ant if you use Ant in other environments, you need to configure the appropriate PATH and ClassPath, add the lib folder under your Ant_home to ClassPath, which contains the basic class package of Ant. Add the bin folder under Ant_Home to your PATH, which can use the ANT tool in the Windows Terminal window.
Ant's execution is an ANT [Scripting File] This format, if there is no script file, then Ant will look for the build.xml file as the current script file in the current folder, if this is also not found, there is no error.
Of course, don't have this trouble in Eclipse. Just run the Ant Build in the Run as run in the eclipse. Ant will automatically find Build.xml in the current project folder. And you can use it directly.
Basic knowledge introduction, start entering the topic: Ant's build.xml writing. The following is the development of Build.xml in the development of my InterfacePackage project.
First of all, you have to remember that build.xml is an XML document (it seems to be nonsense, because the extension of the file has told us the answer), so the build.xml written must comply with the XML document specification, otherwise Ant will not be ignored (The computer is like this, don't give people a face at all, every time I report it is straightforward, it is cold and ruthless).
XML Version = "1.0" encoding = "UTF-8"?>
Here we basis for several Ant's basic concepts, every script is all the contents of the Project segment, and we can specify the project name and the default Task through the Project tab. Task is a one of the most important concepts in Ant, and Ant completes work by performing a series of tasks in the script, so Task is the soul of Ant.
These are some of my definition. What is Property? It is some attributes of the Ant script, and TASK is the method of the Ant script. It is also an object-oriented. The above Property I don't need to explain that everyone should understand it. One of them belongs to the info suffix refers to the information, and the DIR suffix is of course a folder.