|
ANT is a Java based build tool. It is based on a model, which is extended using Java classes. The configuration files are XML based calling out a target tree where various tasks get executed. An object that implements a particular Task interface runs each task. Therefore ANT allows the user to work on any platform.
Use ANT-build-scripts, integrated with Studio to build the ear-file from sources and xml files. These can be run independently outside Studio. The compilation scripts take care of the dependencies, and then organizes the compilation. Also create Build scripts for nightly builds to enable large-scale application development.
ANT is part of Apache Jakarta Project. To read more on ANT, visit
http://jakarta.apache.org/ant/index.html
Before generating the scripts required, right click on the Desk > Export as Archive. Using this option refreshes the Java archives, Web archives and the enterprise archives. Once the archives have been refreshed, select Build > Update Build Scripts from the main menu. This option brings up the dialog box where the scripts to be updated for the modules along with the deskbuild.xml is displayed. Select the files that are to be updated and click OK.
The options available for automatic build script generation are as follows:
The file build.xml for each source root mapped to an EJB Module, Java Module or a Web Module in the Desk, analyses the dependencies and generates the targets for compiling the sources at the package level.
Example
If the package com.pramati has ten files, all the files get compiled at one time using javac -d classes/EJB_Module com/pramati/*.java.
The information about the dependencies in the modules is stored in a file called master.dep under their respective Source Roots. This file is used to generate the build.xml file. When two packages are inter-dependent, both packages get compiles in one target.
Example
If package A depends on package B, and Package B depends on package A, they are compiled using javac -d classes/EJB_Module A/*.java b/*.java.
The targets compile the sources at the package level. Therefore the xml files have to be updated when new packages are added or existing packages are deleted. This file has also has to be updated when the dependencies between packages change.
Example
The package a.b.c1 was compiled before a.b.c2. After some modifications Classes in package a.b.c1 use classes in package a.b.c2. These two packages then have to be compiled together.
The file deskbuild.xml builds the entire application by compiling the Java Modules, EJB Modules and Web Modules, and packaging the Java archives, Web archives and enterprise archives for the application. This file has a target for each module and archive in the Desk.
For compiling each module in the Desk, the target in the deskbuild.xml file invokes the appropriate targets in the build.xml file of that module. As each module in the Desk may contain only a few packages of the Source Root it points to, only those packages under that module in that target are invoked.
Example
There are two packages called A and B under EJB Module1. Another module called EJB Module2 has a package called C. The file deskbuild.xml has a target called TargetA for EJB Module1 and TargetB for EJB Module2. The file build.xml has one target for compiling package A, one for package B and one for package C. TargetA in the deskbuild.xml file invokes the targets in build.xml that compile packages A and B, and TargetB similarly invokes the target in build.xml that compiles package C.
The XML files in the JARs (ejb-jar.xml and pramati-j2ee-server.xml), WARs (web.xml) and ears (pramati-j2ee-server.xml and application.xml) are not generated at the time of execution of deskbuild.xml script. They are extracted from the JAR and stored under the JAR at the time of generation of this script. When this target is executed, the xml files are included along with the built contents. There is also one target each for the JARs, WARs and ears in the desk.
The xml files of the archives are not generated when the scripts are updated. Therefore each time new beans are added to the Java archive, or JSP files are added to the web archive or the resources changed, update the build scripts.
Studio allows running "ANT" on specific Ant xml files. Follow the given steps and execute the ANT XML files from inside Studio:
ant -buildfile FILENAME TARGETNAME.| Pramati Technologies © Copyright |
|