Apache Ant: Apache Ant Is A Java-Based Build Tool. In Theory, IT IS Kind of Like Make, But Without make's Wrinkles
The above is the official definition, it is white, it is compilation tool, free, and efficient.
I specifically define it for writing EJB: Build.xml
Everyone knows that when Ant is a project, you must write an XML. In order to save money, do not buy JBuilder, develop tools: IDEA, NetBean and Eclipse, I am not very familiar with Eclipse, for JB and IDEA More, however, in the general compiler, we can't form two JAR files, if you plan to use EJB, and you are ready to use distributed deployment, you will have to create a new generation from your EJB's client. The JAR file does not contain yourejbnamebean. Also deploying EJB on JBoss, you must include two XML files in your meta-inflicity: ejb-jar.xml and jboss.xml, in jbuilder, you can freely increase the XML files in Jar, don't work in IDEA And Ant can be arbitrarily increased.
In order to achieve the above two purposes, I preplute the build.xml file as follows:
XML Version = "1.0" encoding = "GB2312"?>
BUILD.XML of Jakarta-Ant-1.6alpha in Ant
Copyright (c) 2002 The Neusoft Software Foundation. All Rights Reserved.
============================================================================================================================================================================================================= ==========
->
The document structure is:
...
target>
...
target>
provject>
Project represents a project,
Default: Target (task group) running to the name "dist"
Basedir: Benchmark path.
->
Define properties (Property Tasks) It is best to use the path, the name is defined here into a global variable. Example: Definition You can use it in the future: Now: b == "Hello / B" ============================================================================================================================================================================================================= ========= -> "DOCS directory" - app ->
Define a set of paths after you can reuse this set of paths, for example: -> path>
INIT Preparation Directory (File Tasks) The main directory structure is usually not changed, build them together -> target>
============================================================================================================================================================================================================= ==== Build the code (Compile Tasks, File Tasks) ============================================================================================================================================================================================================= ==== -> javac> target>
============================================================================================================================================================================================================= =========== Copy-related deployment XML file to meta-inf -> Tofile = "$ {build.classes.metainf} /ejb-jar.xml" /> Tofile = "$ {build.classes.metainf} /jboss.xml" /> target>
============================================================================================================================================================================================================= ======= Packing document (Archive Tasks) Create The Project Jars: xxx1.jar and xxx2.jar ============================================================================================================================================================================================================= ========== -> COM / collegesoft / training / ejb / helloejb / hellobean.class "/> target>
============================================================================================================================================================================================================= =========== Creates the API Documentation ============================================================================================================================================================================================================= ============ -> Depends = "jars" Description = "-> Creates the API Documentation> copy> SourcePath = "$ {src.main}" DEFAULTEXCLUDES = "YES" destdir = "$ {build.docs.api}" Author = "True" Version = "True" Use = "true" Windowtitle = "DOCS API"> javadoc> target>
============================================================================================================================================================================================================= ==== Create The Distribution That Can Run (Archive Tasks) Mainly from the Copy's COPY from each directory ============================================================================================================================================================================================================= === -> copy> copy> copy> copy> target>
============================================================================================================================================================================================================= ==== Cleans Everything (File Tasks) For example, you can delete files in build, leave it to you. ============================================================================================================================================================================================================= ==== -> copy> copy> copy> copy> target> provject> Many people start watching this document at first, it will not be able to touch it, it is very simple, first explain it. OK, let's find the label of the Name = "dist" Target: copy> copy> copy> copy> target> The other information is described in this label, which shows that the Javadocs tag must be completed before doing this action, then we continue to find target name = "javadoc" tag, according to this class, finally discovered The first execution is init this Target, so when writing Builder.xml, he wrote, because actual Ant is executed, starting from him.