Eclipse Quick Start Guide to use Ant Author: Anonymous from: J2ME Development Network Ant is a Java platform batch command great program that can automatically compile, test, package, deploy, and so a series of tasks. Ant is a very great batch command executor under the Java platform, which is very convenient to automatically complete compilation, test, packaging, deployment, etc., greatly improve development efficiency. If you haven't started using Ant yet, then you will start learning to use, so that your development level is a new level. Ant has been integrated in Eclipse, we can run Ant directly in Eclipse. Take the Hello project established as an example, create the following directory structure: Create a build.xml, put it in the root directory. Build.xml defines the batch command to be executed. Although Ant can also use other file names, compliance can be more standardized and easy to communicate with others. Typically, the SRC stores the Java source file, Classes stores compiled Class files, lib stores all JAR files for compilation and running, Web stores JSP, etc., DISS is stored, the packaged JAR file, and the DOC stores the API document.
Then create a build.xml file in the root directory, enter the following:
NClude Name = "** / * test. *" /> ]> DOCTITLE>
Select Hello Engineering, then select "Project", "Properties", "Builders", "New ...", select "Ant Build": Fill in Name: Ant_Builder; BuildFile: Build.xml; Base Directory: $ {Workspace_loc: / Hello } (Press "Browse Workspace" to select the project root directory), due to the junit.jar package, search the eclipse directory, find junit.jar, copy it into the Hello / Lib directory, add to the ClassPath in Ant: and then Top of Ant_Build in the Builder panel, remove Java Builder: Compile again, you can see the output of Ant on the console: BuildFile: f: /eclipse-projects/hello/build.xmlinit: compile: [mkdir] create Dir: f: / eclipse-projects / Hello / classes [javac] Compiling 2 source files to F: / eclipse-projects / Hello / classestest: [mkdir] Created dir: F: / eclipse-projects / Hello / report [junit] Running example.HelloTest [JUnit] Tests Run: 1, Failures: 0, Errors: 0, Time Elapsed: 0.02 Secpa: [MKDIR] Created Dir: f: / Eclipse-Projects / Hello / Dist [jar] building jar: f: / Eclipse-Projects /Hello/dist/hello.jardoc:[mkdir] Created dir: F: / eclipse-projects / Hello / doc [javadoc] Generating Javadoc [javadoc] Javadoc execution [javadoc] Loading source files for package example ... [javadoc] Constructing Javadoc Information ... [javadoc] Standard Doclet version 1.4.2_04 [javadoc] Building tree for all the packages and classes ... [javadoc] Building index for all the packages and classes ... [javadoc] Building index for all classes ... [javadoc] Generating F: /eclipse-projects/Hello/doc/stylesheet.css...[javadoc] Note: Custom tags that could override future standard tags:. (.) @todo To avoid potential overrides, use at least one period character in custom tag names [javadoc] NOTE: Custom Tags That Were Not See: @todobuild SuccessFultotal Time: 11 Seconds Ant sequentially performs initialization, compile, test, packaging,