I have wanted to study Ant very early, but I haven't started, I have a space today, come to learn! Ant is a project of famous Java open source organization Apache, is a Java-based build tool. It allows you to copy your project to a directory through the Ant scripting language, publish the project, or generate some code, and execute the SQL language. In short, it can help you complete most of the auxiliary work other than the development code in the project development. Why do you need to write Ant scripts manually? Many IDE tools will generate ANT scripts. Some people will ask this. To know something that is automatically generated by IDE, there is always such shortcomings, and insufficient, he can't fully meet your needs. If there is a problem, you have to manually modify the ANT script, this time if you don't understand Ant, then you will fight. So in order to make your own project more specialized, or if you want to show in front of the leader (sometimes it is useful). Still find out Ant.
Ant installation uses the installation of the Ant installation is simple, as long as you download his ZIP package from the Apache website, then extract to any local disk, add the value of the PATH in the environment variable plus% Ant_Home% / bin, this is You can use Ant this command in the DOS prompt. Others you need to set up Ant_home this environment variable for you to decompress the directory. Also, you have to check your JDK installation directory java_home is not adding to your environment variable. Use an overview to use Ant is also very simple. The usual approach is to build an XML file in your project, and the name can usually take build.xml. Of course you can take any name you like. This file is a batch file you need Ant to make some auxiliary work to your project. His format may be like this. We don't specifically say Ant markers, first have a sense of understanding, it will get started.
Example: XML Version = "1.0" encoding = "UTF-8"?>
The following is a typical example.
The debug parameter is indicating that the source is needed to compile the debug information. If this parameter is not added equal to the back of the command line, the parameter is added. Encoding This parameter indicates which coding method is encoded in your Source file, which is important for the code with Chinese text. ClassPath indicates that the JAR package you need to apply, or the location of other Class files, this is also a very important option. There are several ways in use.
Copy file operation
Others are some of the relatively classic operations of Real-World during the specific development process. For example, use the XDoclet to automatically generate the Hibernate configuration file, perform SQL scripts, which will be described in detail in the subsequent introduction. Mastering them, you will greatly improve work efficiency during the production process, others will also think about you, don't forget to share with your colleagues. Reference Apache Ant Main Station: http://ant.apache.org/