Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ant Presented by: Mindaugas Idzelis Tatum Krawczyk.

Similar presentations


Presentation on theme: "Ant Presented by: Mindaugas Idzelis Tatum Krawczyk."— Presentation transcript:

1 Ant Presented by: Mindaugas Idzelis Tatum Krawczyk

2 Outline What is ant? Why another build tool? How does it work? Tasks (built-in, optional, and third-party) Demo Sample build file Using ant, sample output IDE (Integrated Development Environment) Integration Graphical buildfile editor – Antidote Pros and Cons

3 What is it? Ant is a Java-based build tool Open Source Portable

4 Why another build tool? Whats wrong with make? Cryptic syntax Depends on commands found on specific OS Makefiles can execute incorrectly if tab characters are present Only runs in UNIX-like environments Ant Extended using java classes Configuration done using XML Each task is run by an object that implements a particular task interface

5 How does it work? Hierarchical model A java project will typically have one build file typically named ‘build.xml’ A build file contains a bunch of targets A target is a set of commands that are given a name For example, ‘compile’, ‘document’, or ‘distribute’ Like in make, a target can depend on other targets

6 How does it work (cont) Targets contain a set of tasks A task is a command that is executed, like compiling, copying files, etc Ant’s tasks are implemented using java classes Tasks can be built in, optional, third-party or custom commands The target that you want to run is specified on the command line If nothing is specified, default target is run Targets are only run once at most

7 Creating an ant project Create some source files Create a XML build file Create a bunch of targets (i.e. init, build, clean) Fill them in with appropriate commands Run ant on the build file specifying a target if different from default

8 Examples of tasks Built in tasks Directory tasks Chmod, Delete, Move, Copy, mkdir ChmodDeleteMoveCopymkdir Compression tasks Zip, Gzip, Jar, War, Ear, Tar ZipGzipJarWarEarTar Other tasks Java, Javac, javadoc, style, patch, cvs, signjar, sql, mail, get, parallel, exec, tstamp, touch JavaJavacjavadocstylepatchcvssignjarsql mailgetparallelexectstamptouch

9 Examples of tasks Optional Tasks Source management Clearcase, perforce, pvcs, continuus/synnergy, MS visual sourcesafe, starteam Testing/profiling Junit, jprobe, metamata metrics Network telnet, ftp, mime-mail Misc.NET, cab, ejb, javacc, netrexx, XmlValidate

10 Examples of tasks Custom/Third party tasks AspectJ Runs Aspect for Java compiler Anakia xml transformation tool Checkstyle Java source code checker Importscrubber Removes unnecessary import statements from a Java source code file Jalopy Source code formatter J2ME

11 Sample build file Build.xml

12 IDE Integration An IDE is basically a text editor designed for source code with a compiler, debugger, and other utilities built in. Java IDE’s that integrate with ant Jbuilder Jext (Java text editor) NetBeans & Forte for Java VisualAge for Java Websphere Studio Application Designer

13 Graphical Build file editor Antidote Alleviates some of the mistakes that can be made typing ant build file by hand Produces only valid ant build files Prompts you for required attributes, and displays drop down lists for the optional attributes Still in development, only available in source form from the source repository at apache.org

14 Pros and Cons Ant as a tool Pros Considered the “standard” java make tool Supported by many java vendors including IBM, Borland, Sun Completely written in java, so its portable It is simple to use, powerful, extensible Cons Must be installed in order to be used Build files that depend on optional tasks might not work without additional.jar libraries XML configuration file (required knowledge of XML)  Steep learning curve

15 Criticisms of the XML format it uses Since the ‘depends’ attribute of the element can contain multiple dependencies separated by commas, the text of the attribute must be parsed separately. Also means that it can’t be validated using a DTD Why not make this an id-ref? Will allow xml format to validate references by itself. Response: Making it an id-ref will disallow the possiblity of the following:

16 Questions

17 Sources Jakarta ant web site http://jakarta.apache.org/ant Ant documentation http://jakarta.apache.org/ant/manual/index.html Ant resources http://jakarta.apache.org/ant/resources.html Ant presentation to Tucson JUG Ant presentation to St. Louis JUG


Download ppt "Ant Presented by: Mindaugas Idzelis Tatum Krawczyk."

Similar presentations


Ads by Google