1. Download and install ant. apache-ant-1.8.2 is used here. Unzip the package without installation. Put it in a directory, such as D: \ Program Files (x86) \ apache-ant-1.8.2
Second: configure the ant environment variable. First configure ANT_HOME = D: \ Program Files (x86) \ apache-ant-1.8.2, and then add D in the configuration path: \ Program Files (x86) \ apache-ant-1.8.2 \ bin, because we want to run ant, it is actually in the ant package running, ant under bin. bat file, so you need to configure the bin to the path
Third: Package
---- During packaging, we usually use it directly in the ide, such as myeclipse. When installing myeclipse, there is a built-in ant, such as opening, window -- preferences -- input ant -- runtime -- ant home entries, many of which are supported by the ant jar package under the eclipse installation directory. In the system, we create a new build. xml, and then add the parameter file to build, build. properties. At this time, let's look at build. xml is a file with little ant Peugeot. Right-click and choose run as --- ant. You can also choose to execute build. the target in xml. the structure and command usage in xml are no longer described. Now, it is okay to use it. When the right key is executed, the specific execution process is output on the console, in this case, we need to package the project into jar or war. The difference between the two is described on the Internet, but I feel It seems that there is no difference. You can use decompilation to open the jar or modify the war to zip before decompilation. We can see that the structure of the two is the same, and it will not be delayed. So far, the first package is complete.
Second, it must be dos to use ant for packaging. At this time, we will install ant and configure the environment variables in front of it. We will always switch to the project directory with the cd in dos, go to the project name and run ant war. Here we will mention that ant is a command and war is a build. A target defined in the xml file. For example, in build. xml defines a clean target, and we can run ant clean. Then, the same console as in myeclipse will be printed, executed, and packed, the system will prompt you how many seconds are used. The packaging operation is complete now.