Using ANT flexible to build web applications in Eclipse: Yulong.com Blog Dream Flying Preface Ant is an important part of the Java Developer Toolbox, JUnit, XDoclet, etc., is closely related to it, and programmers may get used to the automatic build provided by IDE, Even the features that are deployed, thereby ignore the ANT itself. In fact, mainstream IDE is usually built-in Ant task to complete these work, familiar with Ant's internal mechanism, you can read or simply modify Build.xml can undoubtedly help you integrate more flexibly. Managing application projects, if you need to learn Maven's open source project management solution, it is also based on understanding Ant. In addition, the process of using ANT actually documents the construction, it is no IDE, imagined, your colleague may be in one-third of JBuilderx, one-third with Eclipse, and some of. I use Eclipse3.0.1, the previous build and release work is made by myECLIPSE plug-in, and the weekend practiced manual construction and remember this. Practice Preparation: This is my personal habit, put all the public class library JARs in a fixed directory, divided into a class, don't lose it under a folder, such as Jakarta-Commons, Hibernate, Spring, Struts, etc. The source code is required to be used, there may be some no need to play in the deployment, such as servlet.jar. If you have your own Framework, you will be placed here. Then, open Eclipse, enter Windows-> Preferences-> Java-> User Libraries, add a book, such as MYLIB, add all the public JARs all, so there is a good place, in the Eclipse project, no need See the annoying long JAR list, which is more tidy. Official to do: 1. Create a new Java Project, do not choose some of your J2EE plugins to have some options to be simple. 2. Create a few folders in root, we can often see these in the open source project downloaded online, such as: SRC - Source Classes - Compile Web - JSP and other lib - libraries, here you can simply put the east under Mylib East COPY came over to release the source code in the future. DList - Of course, we have to build a build.xml, and an ant small icon will appear in Eclipse. After this file is established, the next project is simple COPY, and it is possible to change it. 3. Open the properties page of the project, in the Java Build Path library option, join our custom public library MYLIB. As for the builders, you don't have to change it. Use the default Java Builer, I just use Ant when the project is deployed. The usual tired work will be handed over to the IDE. 4. Heavy weight, write your build.xml, online article is very sea, I will no longer be embarrassed here, basically in the same task: 4.1 To declare some path variables first, such as
You can also write it to the Properties file, here reference;
4.2 Declaring Compilation Class Path, as follows:
4.4 Compilation Construction:
4.6 Take a few tasks together and get a default target