SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Downloaden Sie, um offline zu lesen
ANT

    Official ANT site:
    −   http://ant.apache.org

    Wikipedia topic:
    −   http://en.wikipedia.org/wiki/Apache_Ant
ANT - Introduction

    Apache Ant is a Java-based build tool. In
    theory, it is kind of like make, without make's
    wrinkles.

    Don't worry about make if you don't know
    what it is.

    http://www.gnu.org/software/make/
    −   If you still want to know what make is.
ANT - Why?

    Ant is cross-platform, you can use it any of
    the commonly available OS like Windows,
    Unix and Mac.

    Ant can be extended by writing Java classes,
    again the extensions are portable across
    platform thanks to Java.

    Configuration files are XML based –
    commonly used configuration language.
ANT - Installation

    The latest stable version of Ant is available
    from the Ant web page http://ant.apache.org/

    Setup
    −   Set the ANT_HOME environment variable to the
        directory where you installed Ant.
    −   Add ANT_HOME/bin directory to your PATH
    −   Optionally, set the JAVA_HOME environment
        variable. This should be set to the directory
        where your JDK is installed.
Using ANT

    Ant's build files are written in XML.

    Each build file contains one project and at
    least one (default) target.

    Targets contain task elements.

    Each task element of the build file can have
    an id attribute and can later be referred to by
    the value supplied to this (unique).
ANT buildfile

    Ant's build file are named 'build.xml' and
    stored in your project folder.
    −   NOTE: Ant's option -f or -buildfile can indicate
        the build file with the name other than default

    Example:
    −   /home/user/project_unix/build.xml
    −   C:Usersuserproject_winbuild.xml

  ant -projecthelp
(prints all targets in build.xml)
buildfile <project> element

    <project> is the root element. All build.xml
    begins with this element.
<project name="MyProject" default="dist" basedir=".">
  <description>
     simple example build file
  </description>
</project>


    name, default and basedir are the 3
    attributes of <project> element.
<project> element attributes

    name
    −   The name of the project (can be anything)

    default
    −   the default target to use when no target is
        supplied.

    basedir
    −   the base directory from which all path
        calculations are done. If the property is not set,
        the parent directory of the build file will be used.
buildfile <target> element

    Each project defines one or more targets.

    A target is a set of tasks you want to be
    executed.

    When starting Ant, you can select which
    target(s) you want to have executed.

    A target can depend on other targets.
buildfile <target> element
<project name="MyProject" default="dist" basedir=".">

 <description>
   simple example build file
 </description>

 <target name="init">
  <!-- Create the time stamp -->
  <tstamp/>
  <!-- Create the build directory structure for compilation -->
  <mkdir dir="${build}"/>
 </target>

</project>
buildfile <property> element

    A project can have a set of properties.

    These might be set in the build file by the
    property task, or might be set outside Ant.

    A property has a name and a value; the
    name is case-sensitive.

    Value of a property may be used in the task
    attributes by placing the property name
    between "${" and "}" .
buildfile <property> element
<project name="MyProject" default="dist" basedir=".">
  <description>simple example build file</description>

 <!-- set global properties for this build -->
 <property name="src" location="src"/>
 <property name="build" location="build"/>
 <property name="dist" location="dist"/>
 <target name="init">
  <!-- Create the time stamp -->
  <tstamp/>
  <!-- Create the build directory structure used for compilation -->
  <mkdir dir="${build}"/>
 </target>
</project>
System Properties

    Ant provides access to all system properties
    as if they had been defined using a
    <property> task.

    System Properties such as..
    −   Key                      Description of Associated
        Value
         
             java.version    Java Runtime Environment version
         
             java.vendor      Java Runtime Environment vendor
         
             java.vendor.url Java vendor URL
         
             java.home     Java installation directory
              −   And many more system properties...
Built-in Properties

    In addition, Ant has some built-in properties:
       
           basedir = the absolute path of the project's basedir
           (as set with the basedir attribute of <project>).
       
           ant.file = the absolute path of the buildfile.
       
           ant.version = the version of the executing Ant
       
           ant.project.name = the value of the name attribute of
           <project>.
       
           ant.java.version = the JVM version Ant detected; for
           example "1.4", "1.5" .
ANT Buildfile - Example
<project name="MyProj" default="dist" basedir=".">               <target name="dist" depends="compile"
  <description>                                                      description="generate the distribution" >
      simple example build file                                   <!-- Create the distribution directory -->
  </description>                                                  <mkdir dir="${dist}/lib"/>
 <!-- set global properties for this build -->
 <property name="src" location="src"/>                            <!-- Put everything in ${build} into the Jar file -->
 <property name="build" location="build"/>                        <jar jarfile="${dist}/lib/MyProj-20001128.jar"
 <property name="dist" location="dist"/>                            basedir="${build}"/>
                                                                 </target>
 <target name="init">
  <!-- Create the time stamp -->                                 <target name="clean" description="clean up" >
  <tstamp/>                                                       <!-- Delete the ${build} and ${dist} directory trees -->
  <!-- Create the build directory structure for compiling -->     <delete dir="${build}"/>
  <mkdir dir="${build}"/>                                         <delete dir="${dist}"/>
 </target>                                                       </target>
                                                                </project>
 <target name="compile" depends="init"
     description="compile the source " >
  <!-- Compile the java code from ${src} into ${build} -->
  <javac srcdir="${src}" destdir="${build}"/>
 </target>
Path-like structures

    You can specify PATH and CLASSPATH
    type references using both ":" and ";" as
    separator characters. Ant will convert the
    separator to the correct character of the
    current operating system.
    <classpath>
     <pathelement path="${classpath}"/>
     <pathelement location="lib/helper.jar"/>
    </classpath>
Running ANT

    running Ant from the command-line is simple:
    just type ant .
    −   When no arguments are specified, Ant looks for a
        build.xml file in the current directory and, if found,
        uses that file as the build file and runs the target
        specified in the default attribute of the <project> tag.
    −   To make Ant use a build file other than build.xml,
        use the command-line option -buildfile
        someFile.xml , where someFile.xml is the name of
        the build file you want to use.
Running ANT - Options
ant [options] [target [target2 [target3] ...]]       -buildfile <file>     use given buildfile
                                                       -file <file>            ''
Options:                                               -f     <file>          ''
 -help, -h           print this message              -D<property>=<value> use value for given
 -projecthelp, -p       print project help               property
     information                                     -keep-going, -k         execute all targets that
 -version            print the version information       do not depend on failed target(s)
     and exit                                        -propertyfile <name> load all properties
 -debug, -d           print debugging                    from file with -D properties taking
     information                                         precedence
 -lib <path>          specifies a path to search     -find <file>         (s)earch for buildfile
     for jars and classes                                towards the root of the filesystem and use
 -logfile <file>      use given file for log             it
   -l <file>              ''                         -noclasspath            Run ant without using
 -logger <classname> the class which is to               CLASSPATH
     perform logging                                 -main <class>           override Ant's normal
                                                         entry point
Tasks

    Task - a piece of code that can be executed.
     −   A task can have multiple attributes. The value of
         an attribute might contain references to a
         property. These references will be resolved
         before the task is executed.

    Tasks have a common structure:
    <taskname attribute1="value1" attribute2="value2" ... />
     − where taskname is the name of the task,
         attributeN is the attribute name, and valueN is
         the value for this attribute.
ANT Tasks - Categorized
                                 Archive Tasks
    Given the large
                             
                            
                                 Audit/Coverage Tasks
                                 Compile Tasks
    number of tasks
                             

                             
                                 Deployment Tasks
                                 Documentation Tasks
    available with Ant, it
                             

                             
                                 EJB Tasks
                                 Execution Tasks
    may be difficult to
                             

                             
                                 File Tasks
                                 Java2 Extensions Tasks
    get an overall view
                             

                             
                                 Logging Tasks
                                 Mail Tasks
    of what each task
                             

                             
                                 Miscellaneous Tasks
                                 .NET Tasks
    can do.
                             

                             
                                 Pre-process Tasks
                             
                                 Property Tasks
                             
                                 Remote Tasks
                             
                                 SCM Tasks
                             
                                 Testing Tasks
ANT Tasks - Reference

    Copy                              
                                           Copy a single file
                                      <copy file="myfile.txt"
    −   Copies a file or resource
                                        tofile="mycopy.txt"/>
        collection to a new file or   
                                           Copy a single file to a
        directory.
                                           directory
    −   By default, files are only    <copy file="myfile.txt"
        copied if the source file       todir="../some/other/dir"/>
        is newer than the             
                                           Copy a directory to another
        destination file, or when          directory
        the destination file does         <copy todir="../new/dir">
        not exist.                         <fileset dir="src_dir"/>
    −   Note: overwrite attribute         </copy>
        will explicitly overwrite
        files.
ANT Tasks - Reference

    Delete                          
                                        Delete a single file
                                    <delete file="/lib/ant.jar"/>
    −   Deletes a single file, a    
                                        Delete a directory
        specified directory and
                                    <delete dir="lib"/>
        all its files and           
                                        Deletes all files and
        subdirectories, or a set
                                        subdirectories of build,
        of files specified by one
                                        including build itself
        or more resource            <delete includeEmptyDirs="true">
        collections.                 <fileset dir="build"/>
                                    </delete>
ANT Core Tasks

    Javac           
                        Property

    Java            
                        LoadProperties

    Copy            
                        Import

    Delete          
                        Unzip

    Mkdir           
                        Unjar

    Zip             
                        Unwar

    Jar             
                        Tar

    War             
                        Untar

    Ear             
                        Signjar

    Exec            
                        Sleep

    Echo            
                        Sql
Tutorial – Hello World

    Preparing the Hello World project
    −   We want to separate the source from the
        generated files, so our java source files will be in
        src folder. All generated files should be under
        build, and there split into several sub-directories
        for the individual steps: classes for our compiled
        files and jar for our own JAR-file.
Hello World – Manual Steps

    Manual not using Ant                      Compile :
                                              javac -sourcepath src -d buildclasses
                                                  srctutorHelloWorld.java
Directory creation :
   − mkdir src                                Run :
                                              java -cp buildclasses tutor.HelloWorld
   − mkdir buildclasses
                                              Jar :
//HelloWorld.java                             echo Main-Class:
package tutor;                                     tutor.HelloWorld>myManifest
public class HelloWorld {                     mkdir buildjar
  public static void main(String[ ] args) {   jar cfm buildjarHelloWorld.jar myManifest -C
     System.out.println("Hello World");            buildclasses .
  }                                           java -jar buildjarHelloWorld.jar
}
Hello World – Manual to ANT

    Manual to Ant - thinking the build process

    Possible targets that evolved from the
    previous example
    −   Compile
    −   Jar
    −   Run

    Its a good practice to have a 'clean' target
    −   Clean


    Let's write the build.xml in the next slides.
Hello World - build.xml
<project>                                 <target name="jar">
                                           <mkdir dir="build/jar"/>
 <target name="clean">                     <jar
  <delete dir="build"/>                    destfile="build/jar/HelloWorld.jar"
 </target>                                 basedir="build/classes">
 <target name="compile">                    <manifest>
  <mkdir dir="build/classes"/>                <attribute name="Main-Class"
  <javac srcdir="src"                      value="tutor.HelloWorld"/>
  destdir="build/classes"/>                 </manifest>
 </target>                                 </jar>
 <target name="run">                      </target>
  <java jar="build/jar/HelloWorld.jar"
  fork="true"/>                          </project>
 </target>
Hello World – Invoking Build

    Now you can compile, package and run the
    application via
    −   ant compile
    −   ant jar
    −   ant run


    Or shorter with
    −   ant compile jar run
Manual vs ANT - Comparison
Shell + JAVA                           ANT
mkdir buildclasses                    <mkdir dir="build/classes"/>
javac                                  <javac
   -sourcepath src                        srcdir="src"
   -d buildclasses                       destdir="build/classes"/>
   srctutorHelloWorld.java           <mkdir dir="build/jar"/>
echo Main-Class: tutor.HelloWorld>mf   <jar
mkdir buildjar                           destfile="build/jar/HelloWorld.jar"
jar cfm                                   basedir="build/classes">
   buildjarHelloWorld.jar             <manifest>
   mf                                     <attribute name="Main-Class"
   -C buildclasses                        value="tutor.HelloWorld"/>
   .                                    </manifest>
                                       </jar>
java -jar buildjarHelloWorld.jar     <java jar="build/jar/HelloWorld.jar"
                                           fork="true"/>
Hello World – Enhancing Build

    Some for enhancements:
    −   many time referencing the same directories
    −   main-class and jar-name are hard coded
    −   the right order of build steps required to run.


    The first and second point would be
    addressed with properties, the third with a
    special property - an attribute of the
    <project>-tag and the fourth problem can be
    solved using dependencies.
Hello World – build.xml (update)
<project name="HelloWorld" basedir="."         <target name="jar" depends="compile">
   default="main">                              <mkdir dir="${jar.dir}"/>
 <property name="src.dir" value="src"/>         <jar destfile="${jar.dir}/apache-ant.jar"
 <property name="build.dir" value="build"/>      basedir="${classes.dir}">
 <property name="classes.dir"                     <manifest>
   value="build/classes"/>                         <attribute name="Main-Class" value="$
 <property name="jar.dir"                        {main-class}"/>
   value="build/jar"/>                            </manifest>
 <property name="main-class"                    </jar>
   value="tutor.HelloWorld"/>                  </target>
 <target name="clean">                         <target name="run" depends="jar">
  <delete dir="build"/>                         <java jar="${jar.dir}/apache-ant.jar"
 </target>                                       fork="true"/>
 <target name="compile">                       </target>
  <mkdir dir="${classes.dir}"/>                <target name="clean-build"
  <javac srcdir="src"                            depends="clean,jar"/>
   destdir="{classes.dir}"/>                   <target name="main"
 </target>                                       depends="clean,run"/>
                                              </project>
Hello World – Invoke New Build

    Now it's easier, just do 'ant' and you will get
Buildfile: build.xml
clean:
compile:
   [mkdir] Created dir: C:...buildclasses
   [javac] Compiling 1 source file to C:...buildclasses
jar:
   [mkdir] Created dir: C:...buildjar
      [jar] Building jar: C:...buildjarHelloWorld.jar
run:
     [java] Hello World
main:
BUILD SUCCESSFUL
ANT Core Types - PatternSet

    PatternSet
    −   Patterns can be grouped to sets and later be
        referenced by their id attribute. They are defined
        via a patternset element, which can appear
        nested into a FileSet or a DirSet.
    −   In addition, patternsets can be defined as a
        stand-alone element at the same level as target -
        i.e., as children of project as well as as children
        of target.
ANT Core Types - PatternSet

    PatternSet
<patternset id="non.test.sources">
 <include name="**/*.java"/>
 <exclude name="**/*Test*"/>
</patternset>
    −   Builds a set of patterns that matches all .java
        files that do not contain the text Test in their
        name. This set can be referred to via <patternset
        refid="non.test.sources"/>, by tasks that support
        this feature, or by FileSets.
ANT Core Types - Selectors

    Selectors are a mechanism whereby the files
    that make up a <fileset> can be selected
    based on criteria other than filename as
    provided by the <include> and <exclude>
    tags.
    −   How to use a Selector - A selector is an element
        of FileSet, and appears within it. It can also be
        defined outside of any target by using the
        <selector> tag and then using it as a reference.
Types – Available Selectors

    <contains> - Select files that contain a        
                                                        <present> - Select files that either do or
    particular text string                              do not exist in some other location

    <date> - Select files that have been            
                                                        <containsregexp> - Select files that
    modified either before or after a particular        match a regular expression
    date and time                                   
                                                        <size> - Select files that are larger or

    <depend> - Select files that have been              smaller than a particular number of bytes.
    modified more recently than equivalent          
                                                        <type> - Select files that are either
    files elsewhere                                     regular files or directories.

    <depth> - Select files that appear so           
                                                        <modified> - Select files if the return
    many directories down in a directory tree           value of the configured algorithm is

    <different> - Select files that are different       different from that stored in a cache.
    from those elsewhere                            
                                                        <signedselector> - Select files if they are

    <filename> - Select files whose name                signed, and optionally if they have a
    matches a particular pattern. Equivalent            signature of a certain name.
    to the include and exclude elements of a        
                                                        <scriptselector> - Use a BSF or JSR 223
    patternset.                                         scripting language to create your own
                                                        selector
Selector Examples - Contains

     Here is an example of how to use the
     Contains Selector:
    <fileset dir="${doc.path}" includes="**/*.html">
     <contains text="script" casesensitive="no"/>
    </fileset>
        − Selects all the HTML files that              contain the string
         script.
Selector Examples - Date

     Here is an example of how to use the Date
     Selector:
    <fileset dir="${jar.path}" includes="**/*.jar">
     <date datetime="01/01/2001 12:00 AM" when="before"/>
    </fileset>
        − Selects all JAR files which were last modified
        before midnight January 1, 2001.
Selector Examples - Depend

     Here is an example of how to use the
     Depend Selector:
    <fileset dir="${ant.1.5}/src/main" includes="**/*.java">
     <depend targetdir="${ant.1.4.1}/src/main"/>
    </fileset>
       − Selects all the Java source files which               were
         modified in the 1.5 release.
ANT Core Types - FileSet

     FileSet
      −   A FileSet is a group of files. These files can be
          found in a directory tree starting in a base
          directory and are matched by patterns taken
          from a number of PatternSets and Selectors.
    <fileset dir="${server.src}" casesensitive="yes">
     <include name="**/*.java"/>
     <exclude name="**/*Test*"/>
    </fileset>
                − Groups all files in directory ${server.src} that are Java source
                  files and don't have the text Test in their name.
FileSet using PatternSet

     FileSet
       −   PatternSets can be specified as nested <patternset>
           elements. In addition, FileSet holds an implicit PatternSet
           and supports the nested <include>, <includesfile>,
           <exclude> and <excludesfile> elements of PatternSet
           directly, as well as PatternSet's attributes.
    <fileset dir="${server.src}" casesensitive="yes">
     <patternset id="non.test.sources">
       <include name="**/*.java"/>
       <exclude name="**/*Test*"/>
     </patternset>
    </fileset>
                −   Groups the same files as the above example, but also
                    establishes a PatternSet that can be referenced in other
                    <fileset> elements, rooted at a different directory.
FileSet using Selectors

     FileSet
      −   Selectors are available as nested elements within the
          FileSet. If any of the selectors within the FileSet do not
          select the file, the file is not considered part of the
          FileSet. This makes a FileSet equivalent to an <and>
          selector container.
    <fileset dir="${server.src}" casesensitive="yes">
     <filename name="**/*.java"/>
     <filename name="**/*Test*" negate="true"/>
    </fileset>
      −   Groups all files in directory ${client.src}, using the
          <filename> selector.
build.xml using build.properties
build.properties

    JAVA_HOME=/usr/java/jdk1.6.0
                                                      
                                                          NOTE:
    PROJECT_PATH=.
                                                          −   'build.xml' can load



    VERSION=0.73

    SOURCE_PATH=${PROJECT_PATH}/src



    BUILD_PATH=${PROJECT_PATH}/build
    DIST_PATH=${PROJECT_PATH}/dist
                                                              'build.properties' by
    CLASSES_PATH=$
                                                              property task



    {BUILD_PATH}/classes/production/sted
    TEST_CLASSES_PATH=$
                                                      <property file="build.properties"



    {BUILD_PATH}/classes/test/sted

    DEPLOY_PATH=${BUILD_PATH}/bin                       description="STED User Environment

    STED.JAR_NAME=sted.jar

    STED-WIDGETS.JAR_NAME=sted-widgets.jar              Settings"/>
                                                              Or by using the
    STED.JAR=${DEPLOY_PATH}/${STED.JAR_NAME}
                                                          −



    STED-WIDGETS.JAR=${DEPLOY_PATH}/${STED-
    WIDGETS.JAR_NAME}



    STED.ZIP_NAME=sted-${VERSION}.zip
    STED.ZIP=${DIST_PATH}/${STED.ZIP_NAME}
                                                              loadproperties task

    STED-FULL.ZIP_NAME=sted-with-src-${VERSION}.zip   <loadproperties

    STED-FULL.ZIP=${DIST_PATH}/${STED-
    FULL.ZIP_NAME}                                       srcfile="build.properties" />
build.xml using build.properties
<project name="STED" default="init" basedir=".">            <target name="copy.resource" depends="init">
                                                             <copy todir="${BUILD_PATH}" verbose="true">
 <property file="build.properties" description="STED User     <fileset dir="${PROJECT_PATH}" excludes="**/build/**,
    Environment Settings"/>                                    **/dist/**, **/test/**" defaultexcludes="true"/>
                                                             </copy>
 <target name="init">                                       </target>
  <tstamp/>
  <!-- Create the directory structure for compile -->       <target name="compile" depends="init"
  <mkdir dir="${BUILD_PATH}"/>                                 description="compiles source">
  <mkdir dir="${CLASSES_PATH}"/>                             <javac srcdir="${SOURCE_PATH}" destdir="$
  <echo message="Project Path: ${PROJECT_PATH}"/>              {CLASSES_PATH}" deprecation="on" verbose="true">
  <echo message="Source Path: ${SOURCE_PATH}"/>              </javac>
  <echo message="Classes Path: ${CLASSES_PATH}"/>            <!-- HACK for development builds only -->
  <echo message="Deploy Path: ${DEPLOY_PATH}"/>              <!-- copy 'config' folder in classes. since ResourceBundle
  <echo message="Jar Path: ${STED.JAR}"/>                      would fail -->
 </target>                                                   <!-- Deployment does not require this hack, because
                                                               STED_HOME is set in classpath -->
 <path id="SOURCE_PATH">                                     <copy todir="${CLASSES_PATH}" verbose="true">
  <pathelement location="${SOURCE_PATH}"/>                    <fileset dir="${PROJECT_PATH}" includes="config/**"
 </path>                                                       defaultexcludes="true"/>
                                                             </copy>
 <path id="CLASS_PATH">                                     </target>
  <pathelement location="${CLASSES_PATH}"/>
 </path>
build.xml using build.properties
<target name="deploy.widgets" depends="compile"             <target name="deploy.sted" depends="copy.resource, compile,
   description="creates sted-widgets.jar">                     deploy.widgets" description="creates sted.jar">
 <jar basedir="${CLASSES_PATH}" destfile="${STED-            <jar basedir="${CLASSES_PATH}" destfile="${STED.JAR}"
   WIDGETS.JAR}"                                               includes="**/intellibitz/**" excludes="**/config/**,
   includes="**/intellibitz/sted/widgets/**">                  **/intellibitz/sted/widgets/**">
  <manifest>                                                  <manifest>
    <attribute name="Built-By" value="IntelliBitz               <attribute name="Main-Class"
   Technologies., Muthu Ramadoss."/>                           value="intellibitz.sted.Main"/>
    <section name="STED Widgets - ReUsable Swing                <attribute name="Built-By" value="IntelliBitz Technologies.,
   Components.">                                               Muthu Ramadoss."/>
     <attribute name="Specification-Title" value="STED"/>       <section name="STED - Free Transliterator/Editor.">
     <attribute name="Specification-Version" value="$            <attribute name="Specification-Title" value="STED"/>
   {VERSION}"/>                                                  <attribute name="Specification-Version" value="$
     <attribute name="Specification-Vendor"                    {VERSION}"/>
   value="IntelliBitz Technologies.,"/>                          <attribute name="Specification-Vendor" value="IntelliBitz
     <attribute name="Implementation-Title"                    Technologies.,"/>
   value="STED"/>                                                <attribute name="Implementation-Title" value="STED"/>
     <attribute name="Implementation-Version" value="$           <attribute name="Implementation-Version" value="$
   {VERSION} ${TODAY}"/>                                       {VERSION} ${TODAY}"/>
     <attribute name="Implementation-Vendor"                     <attribute name="Implementation-Vendor"
   value="IntelliBitz Technologies.,"/>                        value="IntelliBitz Technologies.,"/>
    </section>                                                   </section>
  </manifest>                                                   </manifest>
 </jar>                                                       </jar>
</target>                                                   </target>
build.xml using build.properties
<target name="clean.deploy" depends="clean.build,          <target name="release.sted" depends="clean.deploy"
   deploy.sted" description="cleans and deploys"/>            description="Creates STED Production Deliverable">
                                                            <jar basedir="${BUILD_PATH}" destfile="${STED.ZIP}"
<target name="undeploy" description="removes sted.jar">       excludes="**/classes/**, **/src/**, **/temp/**, $
 <delete verbose="true">                                      {STED.ZIP}, ${STED-FULL.ZIP}">
  <fileset dir="${DEPLOY_PATH}" includes="$                 </jar>
   {STED.JAR_NAME}"/>                                      </target>
 </delete>
</target>                                                  <target name="release.sted-full" description="Creates STED
                                                              Production Deliverable">
<target name="clean.classes" description="deletes           <jar basedir="${BUILD_PATH}" destfile="${STED-
   classes">                                                  FULL.ZIP}" excludes="**/classes/**, **/temp/**, $
 <delete includeemptydirs="true" verbose="true">              {STED.ZIP}, ${STED-FULL.ZIP}">
  <fileset dir="${CLASSES_PATH}"                            </jar>
   excludes="**/.dependency-info/**"                       </target>
   defaultexcludes="false"/>
 </delete>                                                 <target name="run" depends="deploy.sted"
</target>                                                     description="runs sted">
                                                            <!-- WINDOWS -->
<target name="clean.build" description="deletes build       <!--<exec dir="${DEPLOY_PATH}"
   directory">                                                executable="sted.bat"/>-->
 <delete includeemptydirs="true" verbose="true">            <!-- LINUX -->
  <fileset dir="${BUILD_PATH}"                              <exec dir="${DEPLOY_PATH}" executable="./sted.sh"/>
   excludes="**/.dependency-info/**"                       </target>
   defaultexcludes="false"/>
 </delete>                                                </project>
</target>
Summary

    Ant is a cross-platform build tool for Java.

    Ant uses XML based configuration file
    typically named 'build.xml'.

    Project, Targets and Tasks
    −   A build.xml would contain 1 project with one or
        more targets and each of the target containing
        one or more tasks.


    Core and Optional tasks provided by Ant.
Resources

    Official ANT site:
    −   http://ant.apache.org


    ANT Manual:
    −   http://ant.apache.org/manual/index.html


    Wikipedia topic:
    −   http://en.wikipedia.org/wiki/Apache_Ant


    Example project:
    −   http://sted.svn.sf.net/viewvc/sted
ANT says Good Bye!




Thank You!

Weitere ähnliche Inhalte

Was ist angesagt?

ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CICosmin Poieana
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionNate Abele
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013Roland Tritsch
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of LithiumNate Abele
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake TutorialFu Haiping
 
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes ramakesavan
 
Hibernate
Hibernate Hibernate
Hibernate Sunil OS
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or lessrijk.stofberg
 
short_intro_to_CMake_(inria_REVES_team)
short_intro_to_CMake_(inria_REVES_team)short_intro_to_CMake_(inria_REVES_team)
short_intro_to_CMake_(inria_REVES_team)Jérôme Esnault
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with MavenArcadian Learning
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDTBastian Feder
 
Continous delivery with sbt
Continous delivery with sbtContinous delivery with sbt
Continous delivery with sbtWojciech Pituła
 
Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Masha Edelen
 
ITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell ToolmakingITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell ToolmakingKurt Roggen [BE]
 

Was ist angesagt? (20)

ARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CIARGUS - THE OMNISCIENT CI
ARGUS - THE OMNISCIENT CI
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Introduction to jOOQ
Introduction to jOOQIntroduction to jOOQ
Introduction to jOOQ
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
Hibernate
Hibernate Hibernate
Hibernate
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or less
 
short_intro_to_CMake_(inria_REVES_team)
short_intro_to_CMake_(inria_REVES_team)short_intro_to_CMake_(inria_REVES_team)
short_intro_to_CMake_(inria_REVES_team)
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
 
Php Development With Eclipde PDT
Php Development With Eclipde PDTPhp Development With Eclipde PDT
Php Development With Eclipde PDT
 
Continous delivery with sbt
Continous delivery with sbtContinous delivery with sbt
Continous delivery with sbt
 
Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!Let ColdFusion ORM do the work for you!
Let ColdFusion ORM do the work for you!
 
ITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell ToolmakingITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell Toolmaking
 

Andere mochten auch

Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools­Avishek A
 
Zen and-the-art-of-build-script-maintenance-skillsmatter
Zen and-the-art-of-build-script-maintenance-skillsmatterZen and-the-art-of-build-script-maintenance-skillsmatter
Zen and-the-art-of-build-script-maintenance-skillsmatterSkills Matter
 
Angular.js
Angular.jsAngular.js
Angular.jsGDG Cali
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereStrannik_2013
 
Architecting your Frontend
Architecting your FrontendArchitecting your Frontend
Architecting your FrontendRuben Teijeiro
 
Make Your Builds More Groovy
Make Your Builds More GroovyMake Your Builds More Groovy
Make Your Builds More GroovyPaul King
 
4장. Class Loader
4장. Class Loader4장. Class Loader
4장. Class Loader김 한도
 
Tutorial to develop build files using ANT
Tutorial to develop build files using ANTTutorial to develop build files using ANT
Tutorial to develop build files using ANTravireddy76
 
Apache ant
Apache antApache ant
Apache antkoniik
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011Ching Yi Chan
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
Erlang vs. Java
Erlang vs. JavaErlang vs. Java
Erlang vs. JavaArtan Cami
 

Andere mochten auch (20)

Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools
 
Jvm a brief introduction
Jvm  a brief introductionJvm  a brief introduction
Jvm a brief introduction
 
Zen and-the-art-of-build-script-maintenance-skillsmatter
Zen and-the-art-of-build-script-maintenance-skillsmatterZen and-the-art-of-build-script-maintenance-skillsmatter
Zen and-the-art-of-build-script-maintenance-skillsmatter
 
Angular.js
Angular.jsAngular.js
Angular.js
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Architecting your Frontend
Architecting your FrontendArchitecting your Frontend
Architecting your Frontend
 
Make Your Builds More Groovy
Make Your Builds More GroovyMake Your Builds More Groovy
Make Your Builds More Groovy
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
4장. Class Loader
4장. Class Loader4장. Class Loader
4장. Class Loader
 
Tutorial to develop build files using ANT
Tutorial to develop build files using ANTTutorial to develop build files using ANT
Tutorial to develop build files using ANT
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Apache ant
Apache antApache ant
Apache ant
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011
 
Java Classloaders
Java ClassloadersJava Classloaders
Java Classloaders
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Erlang vs. Java
Erlang vs. JavaErlang vs. Java
Erlang vs. Java
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 

Ähnlich wie Ant_quick_guide (20)

Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Build Scripts
Build ScriptsBuild Scripts
Build Scripts
 
Apache ant
Apache antApache ant
Apache ant
 
Apache ant
Apache antApache ant
Apache ant
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee Applications
 
Introduction To Ant1
Introduction To  Ant1Introduction To  Ant1
Introduction To Ant1
 
GradleFX
GradleFXGradleFX
GradleFX
 
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerCustom deployments with sbt-native-packager
Custom deployments with sbt-native-packager
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
Ant tutorial
Ant tutorialAnt tutorial
Ant tutorial
 
Java ant tutorial
Java ant tutorialJava ant tutorial
Java ant tutorial
 
Phing
PhingPhing
Phing
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Simple build tool
Simple build toolSimple build tool
Simple build tool
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Mavenppt
MavenpptMavenppt
Mavenppt
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 

Kürzlich hochgeladen

Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...Daniel Zivkovic
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementNuwan Dias
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdfPaige Cruz
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"DianaGray10
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 

Kürzlich hochgeladen (20)

Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
All in AI: LLM Landscape & RAG in 2024 with Mark Ryan (Google) & Jerry Liu (L...
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API Management
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 

Ant_quick_guide

  • 1. ANT  Official ANT site: − http://ant.apache.org  Wikipedia topic: − http://en.wikipedia.org/wiki/Apache_Ant
  • 2. ANT - Introduction  Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles.  Don't worry about make if you don't know what it is.  http://www.gnu.org/software/make/ − If you still want to know what make is.
  • 3. ANT - Why?  Ant is cross-platform, you can use it any of the commonly available OS like Windows, Unix and Mac.  Ant can be extended by writing Java classes, again the extensions are portable across platform thanks to Java.  Configuration files are XML based – commonly used configuration language.
  • 4. ANT - Installation  The latest stable version of Ant is available from the Ant web page http://ant.apache.org/  Setup − Set the ANT_HOME environment variable to the directory where you installed Ant. − Add ANT_HOME/bin directory to your PATH − Optionally, set the JAVA_HOME environment variable. This should be set to the directory where your JDK is installed.
  • 5. Using ANT  Ant's build files are written in XML.  Each build file contains one project and at least one (default) target.  Targets contain task elements.  Each task element of the build file can have an id attribute and can later be referred to by the value supplied to this (unique).
  • 6. ANT buildfile  Ant's build file are named 'build.xml' and stored in your project folder. − NOTE: Ant's option -f or -buildfile can indicate the build file with the name other than default  Example: − /home/user/project_unix/build.xml − C:Usersuserproject_winbuild.xml  ant -projecthelp (prints all targets in build.xml)
  • 7. buildfile <project> element  <project> is the root element. All build.xml begins with this element. <project name="MyProject" default="dist" basedir="."> <description> simple example build file </description> </project>  name, default and basedir are the 3 attributes of <project> element.
  • 8. <project> element attributes  name − The name of the project (can be anything)  default − the default target to use when no target is supplied.  basedir − the base directory from which all path calculations are done. If the property is not set, the parent directory of the build file will be used.
  • 9. buildfile <target> element  Each project defines one or more targets.  A target is a set of tasks you want to be executed.  When starting Ant, you can select which target(s) you want to have executed.  A target can depend on other targets.
  • 10. buildfile <target> element <project name="MyProject" default="dist" basedir="."> <description> simple example build file </description> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure for compilation --> <mkdir dir="${build}"/> </target> </project>
  • 11. buildfile <property> element  A project can have a set of properties.  These might be set in the build file by the property task, or might be set outside Ant.  A property has a name and a value; the name is case-sensitive.  Value of a property may be used in the task attributes by placing the property name between "${" and "}" .
  • 12. buildfile <property> element <project name="MyProject" default="dist" basedir="."> <description>simple example build file</description> <!-- set global properties for this build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure used for compilation --> <mkdir dir="${build}"/> </target> </project>
  • 13. System Properties  Ant provides access to all system properties as if they had been defined using a <property> task.  System Properties such as.. − Key Description of Associated Value  java.version Java Runtime Environment version  java.vendor Java Runtime Environment vendor  java.vendor.url Java vendor URL  java.home Java installation directory − And many more system properties...
  • 14. Built-in Properties  In addition, Ant has some built-in properties:  basedir = the absolute path of the project's basedir (as set with the basedir attribute of <project>).  ant.file = the absolute path of the buildfile.  ant.version = the version of the executing Ant  ant.project.name = the value of the name attribute of <project>.  ant.java.version = the JVM version Ant detected; for example "1.4", "1.5" .
  • 15. ANT Buildfile - Example <project name="MyProj" default="dist" basedir="."> <target name="dist" depends="compile" <description> description="generate the distribution" > simple example build file <!-- Create the distribution directory --> </description> <mkdir dir="${dist}/lib"/> <!-- set global properties for this build --> <property name="src" location="src"/> <!-- Put everything in ${build} into the Jar file --> <property name="build" location="build"/> <jar jarfile="${dist}/lib/MyProj-20001128.jar" <property name="dist" location="dist"/> basedir="${build}"/> </target> <target name="init"> <!-- Create the time stamp --> <target name="clean" description="clean up" > <tstamp/> <!-- Delete the ${build} and ${dist} directory trees --> <!-- Create the build directory structure for compiling --> <delete dir="${build}"/> <mkdir dir="${build}"/> <delete dir="${dist}"/> </target> </target> </project> <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}"/> </target>
  • 16. Path-like structures  You can specify PATH and CLASSPATH type references using both ":" and ";" as separator characters. Ant will convert the separator to the correct character of the current operating system. <classpath> <pathelement path="${classpath}"/> <pathelement location="lib/helper.jar"/> </classpath>
  • 17. Running ANT  running Ant from the command-line is simple: just type ant . − When no arguments are specified, Ant looks for a build.xml file in the current directory and, if found, uses that file as the build file and runs the target specified in the default attribute of the <project> tag. − To make Ant use a build file other than build.xml, use the command-line option -buildfile someFile.xml , where someFile.xml is the name of the build file you want to use.
  • 18. Running ANT - Options ant [options] [target [target2 [target3] ...]] -buildfile <file> use given buildfile -file <file> '' Options: -f <file> '' -help, -h print this message -D<property>=<value> use value for given -projecthelp, -p print project help property information -keep-going, -k execute all targets that -version print the version information do not depend on failed target(s) and exit -propertyfile <name> load all properties -debug, -d print debugging from file with -D properties taking information precedence -lib <path> specifies a path to search -find <file> (s)earch for buildfile for jars and classes towards the root of the filesystem and use -logfile <file> use given file for log it -l <file> '' -noclasspath Run ant without using -logger <classname> the class which is to CLASSPATH perform logging -main <class> override Ant's normal entry point
  • 19. Tasks  Task - a piece of code that can be executed. − A task can have multiple attributes. The value of an attribute might contain references to a property. These references will be resolved before the task is executed.  Tasks have a common structure: <taskname attribute1="value1" attribute2="value2" ... /> − where taskname is the name of the task, attributeN is the attribute name, and valueN is the value for this attribute.
  • 20. ANT Tasks - Categorized Archive Tasks Given the large    Audit/Coverage Tasks Compile Tasks number of tasks   Deployment Tasks Documentation Tasks available with Ant, it   EJB Tasks Execution Tasks may be difficult to   File Tasks Java2 Extensions Tasks get an overall view   Logging Tasks Mail Tasks of what each task   Miscellaneous Tasks .NET Tasks can do.   Pre-process Tasks  Property Tasks  Remote Tasks  SCM Tasks  Testing Tasks
  • 21. ANT Tasks - Reference  Copy  Copy a single file <copy file="myfile.txt" − Copies a file or resource tofile="mycopy.txt"/> collection to a new file or  Copy a single file to a directory. directory − By default, files are only <copy file="myfile.txt" copied if the source file todir="../some/other/dir"/> is newer than the  Copy a directory to another destination file, or when directory the destination file does <copy todir="../new/dir"> not exist. <fileset dir="src_dir"/> − Note: overwrite attribute </copy> will explicitly overwrite files.
  • 22. ANT Tasks - Reference  Delete  Delete a single file <delete file="/lib/ant.jar"/> − Deletes a single file, a  Delete a directory specified directory and <delete dir="lib"/> all its files and  Deletes all files and subdirectories, or a set subdirectories of build, of files specified by one including build itself or more resource <delete includeEmptyDirs="true"> collections. <fileset dir="build"/> </delete>
  • 23. ANT Core Tasks  Javac  Property  Java  LoadProperties  Copy  Import  Delete  Unzip  Mkdir  Unjar  Zip  Unwar  Jar  Tar  War  Untar  Ear  Signjar  Exec  Sleep  Echo  Sql
  • 24. Tutorial – Hello World  Preparing the Hello World project − We want to separate the source from the generated files, so our java source files will be in src folder. All generated files should be under build, and there split into several sub-directories for the individual steps: classes for our compiled files and jar for our own JAR-file.
  • 25. Hello World – Manual Steps  Manual not using Ant Compile : javac -sourcepath src -d buildclasses srctutorHelloWorld.java Directory creation : − mkdir src Run : java -cp buildclasses tutor.HelloWorld − mkdir buildclasses Jar : //HelloWorld.java echo Main-Class: package tutor; tutor.HelloWorld>myManifest public class HelloWorld { mkdir buildjar public static void main(String[ ] args) { jar cfm buildjarHelloWorld.jar myManifest -C System.out.println("Hello World"); buildclasses . } java -jar buildjarHelloWorld.jar }
  • 26. Hello World – Manual to ANT  Manual to Ant - thinking the build process  Possible targets that evolved from the previous example − Compile − Jar − Run  Its a good practice to have a 'clean' target − Clean  Let's write the build.xml in the next slides.
  • 27. Hello World - build.xml <project> <target name="jar"> <mkdir dir="build/jar"/> <target name="clean"> <jar <delete dir="build"/> destfile="build/jar/HelloWorld.jar" </target> basedir="build/classes"> <target name="compile"> <manifest> <mkdir dir="build/classes"/> <attribute name="Main-Class" <javac srcdir="src" value="tutor.HelloWorld"/> destdir="build/classes"/> </manifest> </target> </jar> <target name="run"> </target> <java jar="build/jar/HelloWorld.jar" fork="true"/> </project> </target>
  • 28. Hello World – Invoking Build  Now you can compile, package and run the application via − ant compile − ant jar − ant run  Or shorter with − ant compile jar run
  • 29. Manual vs ANT - Comparison Shell + JAVA ANT mkdir buildclasses <mkdir dir="build/classes"/> javac <javac -sourcepath src srcdir="src" -d buildclasses destdir="build/classes"/> srctutorHelloWorld.java <mkdir dir="build/jar"/> echo Main-Class: tutor.HelloWorld>mf <jar mkdir buildjar destfile="build/jar/HelloWorld.jar" jar cfm basedir="build/classes"> buildjarHelloWorld.jar <manifest> mf <attribute name="Main-Class" -C buildclasses value="tutor.HelloWorld"/> . </manifest> </jar> java -jar buildjarHelloWorld.jar <java jar="build/jar/HelloWorld.jar" fork="true"/>
  • 30. Hello World – Enhancing Build  Some for enhancements: − many time referencing the same directories − main-class and jar-name are hard coded − the right order of build steps required to run.  The first and second point would be addressed with properties, the third with a special property - an attribute of the <project>-tag and the fourth problem can be solved using dependencies.
  • 31. Hello World – build.xml (update) <project name="HelloWorld" basedir="." <target name="jar" depends="compile"> default="main"> <mkdir dir="${jar.dir}"/> <property name="src.dir" value="src"/> <jar destfile="${jar.dir}/apache-ant.jar" <property name="build.dir" value="build"/> basedir="${classes.dir}"> <property name="classes.dir" <manifest> value="build/classes"/> <attribute name="Main-Class" value="$ <property name="jar.dir" {main-class}"/> value="build/jar"/> </manifest> <property name="main-class" </jar> value="tutor.HelloWorld"/> </target> <target name="clean"> <target name="run" depends="jar"> <delete dir="build"/> <java jar="${jar.dir}/apache-ant.jar" </target> fork="true"/> <target name="compile"> </target> <mkdir dir="${classes.dir}"/> <target name="clean-build" <javac srcdir="src" depends="clean,jar"/> destdir="{classes.dir}"/> <target name="main" </target> depends="clean,run"/> </project>
  • 32. Hello World – Invoke New Build  Now it's easier, just do 'ant' and you will get Buildfile: build.xml clean: compile: [mkdir] Created dir: C:...buildclasses [javac] Compiling 1 source file to C:...buildclasses jar: [mkdir] Created dir: C:...buildjar [jar] Building jar: C:...buildjarHelloWorld.jar run: [java] Hello World main: BUILD SUCCESSFUL
  • 33. ANT Core Types - PatternSet  PatternSet − Patterns can be grouped to sets and later be referenced by their id attribute. They are defined via a patternset element, which can appear nested into a FileSet or a DirSet. − In addition, patternsets can be defined as a stand-alone element at the same level as target - i.e., as children of project as well as as children of target.
  • 34. ANT Core Types - PatternSet  PatternSet <patternset id="non.test.sources"> <include name="**/*.java"/> <exclude name="**/*Test*"/> </patternset> − Builds a set of patterns that matches all .java files that do not contain the text Test in their name. This set can be referred to via <patternset refid="non.test.sources"/>, by tasks that support this feature, or by FileSets.
  • 35. ANT Core Types - Selectors  Selectors are a mechanism whereby the files that make up a <fileset> can be selected based on criteria other than filename as provided by the <include> and <exclude> tags. − How to use a Selector - A selector is an element of FileSet, and appears within it. It can also be defined outside of any target by using the <selector> tag and then using it as a reference.
  • 36. Types – Available Selectors  <contains> - Select files that contain a  <present> - Select files that either do or particular text string do not exist in some other location  <date> - Select files that have been  <containsregexp> - Select files that modified either before or after a particular match a regular expression date and time  <size> - Select files that are larger or  <depend> - Select files that have been smaller than a particular number of bytes. modified more recently than equivalent  <type> - Select files that are either files elsewhere regular files or directories.  <depth> - Select files that appear so  <modified> - Select files if the return many directories down in a directory tree value of the configured algorithm is  <different> - Select files that are different different from that stored in a cache. from those elsewhere  <signedselector> - Select files if they are  <filename> - Select files whose name signed, and optionally if they have a matches a particular pattern. Equivalent signature of a certain name. to the include and exclude elements of a  <scriptselector> - Use a BSF or JSR 223 patternset. scripting language to create your own selector
  • 37. Selector Examples - Contains  Here is an example of how to use the Contains Selector: <fileset dir="${doc.path}" includes="**/*.html"> <contains text="script" casesensitive="no"/> </fileset> − Selects all the HTML files that contain the string script.
  • 38. Selector Examples - Date  Here is an example of how to use the Date Selector: <fileset dir="${jar.path}" includes="**/*.jar"> <date datetime="01/01/2001 12:00 AM" when="before"/> </fileset> − Selects all JAR files which were last modified before midnight January 1, 2001.
  • 39. Selector Examples - Depend  Here is an example of how to use the Depend Selector: <fileset dir="${ant.1.5}/src/main" includes="**/*.java"> <depend targetdir="${ant.1.4.1}/src/main"/> </fileset> − Selects all the Java source files which were modified in the 1.5 release.
  • 40. ANT Core Types - FileSet  FileSet − A FileSet is a group of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of PatternSets and Selectors. <fileset dir="${server.src}" casesensitive="yes"> <include name="**/*.java"/> <exclude name="**/*Test*"/> </fileset> − Groups all files in directory ${server.src} that are Java source files and don't have the text Test in their name.
  • 41. FileSet using PatternSet  FileSet − PatternSets can be specified as nested <patternset> elements. In addition, FileSet holds an implicit PatternSet and supports the nested <include>, <includesfile>, <exclude> and <excludesfile> elements of PatternSet directly, as well as PatternSet's attributes. <fileset dir="${server.src}" casesensitive="yes"> <patternset id="non.test.sources"> <include name="**/*.java"/> <exclude name="**/*Test*"/> </patternset> </fileset> − Groups the same files as the above example, but also establishes a PatternSet that can be referenced in other <fileset> elements, rooted at a different directory.
  • 42. FileSet using Selectors  FileSet − Selectors are available as nested elements within the FileSet. If any of the selectors within the FileSet do not select the file, the file is not considered part of the FileSet. This makes a FileSet equivalent to an <and> selector container. <fileset dir="${server.src}" casesensitive="yes"> <filename name="**/*.java"/> <filename name="**/*Test*" negate="true"/> </fileset> − Groups all files in directory ${client.src}, using the <filename> selector.
  • 43. build.xml using build.properties build.properties  JAVA_HOME=/usr/java/jdk1.6.0  NOTE: PROJECT_PATH=. − 'build.xml' can load   VERSION=0.73  SOURCE_PATH=${PROJECT_PATH}/src   BUILD_PATH=${PROJECT_PATH}/build DIST_PATH=${PROJECT_PATH}/dist 'build.properties' by CLASSES_PATH=$ property task  {BUILD_PATH}/classes/production/sted TEST_CLASSES_PATH=$ <property file="build.properties"  {BUILD_PATH}/classes/test/sted  DEPLOY_PATH=${BUILD_PATH}/bin description="STED User Environment  STED.JAR_NAME=sted.jar  STED-WIDGETS.JAR_NAME=sted-widgets.jar Settings"/> Or by using the STED.JAR=${DEPLOY_PATH}/${STED.JAR_NAME} −   STED-WIDGETS.JAR=${DEPLOY_PATH}/${STED- WIDGETS.JAR_NAME}   STED.ZIP_NAME=sted-${VERSION}.zip STED.ZIP=${DIST_PATH}/${STED.ZIP_NAME} loadproperties task  STED-FULL.ZIP_NAME=sted-with-src-${VERSION}.zip <loadproperties  STED-FULL.ZIP=${DIST_PATH}/${STED- FULL.ZIP_NAME} srcfile="build.properties" />
  • 44. build.xml using build.properties <project name="STED" default="init" basedir="."> <target name="copy.resource" depends="init"> <copy todir="${BUILD_PATH}" verbose="true"> <property file="build.properties" description="STED User <fileset dir="${PROJECT_PATH}" excludes="**/build/**, Environment Settings"/> **/dist/**, **/test/**" defaultexcludes="true"/> </copy> <target name="init"> </target> <tstamp/> <!-- Create the directory structure for compile --> <target name="compile" depends="init" <mkdir dir="${BUILD_PATH}"/> description="compiles source"> <mkdir dir="${CLASSES_PATH}"/> <javac srcdir="${SOURCE_PATH}" destdir="$ <echo message="Project Path: ${PROJECT_PATH}"/> {CLASSES_PATH}" deprecation="on" verbose="true"> <echo message="Source Path: ${SOURCE_PATH}"/> </javac> <echo message="Classes Path: ${CLASSES_PATH}"/> <!-- HACK for development builds only --> <echo message="Deploy Path: ${DEPLOY_PATH}"/> <!-- copy 'config' folder in classes. since ResourceBundle <echo message="Jar Path: ${STED.JAR}"/> would fail --> </target> <!-- Deployment does not require this hack, because STED_HOME is set in classpath --> <path id="SOURCE_PATH"> <copy todir="${CLASSES_PATH}" verbose="true"> <pathelement location="${SOURCE_PATH}"/> <fileset dir="${PROJECT_PATH}" includes="config/**" </path> defaultexcludes="true"/> </copy> <path id="CLASS_PATH"> </target> <pathelement location="${CLASSES_PATH}"/> </path>
  • 45. build.xml using build.properties <target name="deploy.widgets" depends="compile" <target name="deploy.sted" depends="copy.resource, compile, description="creates sted-widgets.jar"> deploy.widgets" description="creates sted.jar"> <jar basedir="${CLASSES_PATH}" destfile="${STED- <jar basedir="${CLASSES_PATH}" destfile="${STED.JAR}" WIDGETS.JAR}" includes="**/intellibitz/**" excludes="**/config/**, includes="**/intellibitz/sted/widgets/**"> **/intellibitz/sted/widgets/**"> <manifest> <manifest> <attribute name="Built-By" value="IntelliBitz <attribute name="Main-Class" Technologies., Muthu Ramadoss."/> value="intellibitz.sted.Main"/> <section name="STED Widgets - ReUsable Swing <attribute name="Built-By" value="IntelliBitz Technologies., Components."> Muthu Ramadoss."/> <attribute name="Specification-Title" value="STED"/> <section name="STED - Free Transliterator/Editor."> <attribute name="Specification-Version" value="$ <attribute name="Specification-Title" value="STED"/> {VERSION}"/> <attribute name="Specification-Version" value="$ <attribute name="Specification-Vendor" {VERSION}"/> value="IntelliBitz Technologies.,"/> <attribute name="Specification-Vendor" value="IntelliBitz <attribute name="Implementation-Title" Technologies.,"/> value="STED"/> <attribute name="Implementation-Title" value="STED"/> <attribute name="Implementation-Version" value="$ <attribute name="Implementation-Version" value="$ {VERSION} ${TODAY}"/> {VERSION} ${TODAY}"/> <attribute name="Implementation-Vendor" <attribute name="Implementation-Vendor" value="IntelliBitz Technologies.,"/> value="IntelliBitz Technologies.,"/> </section> </section> </manifest> </manifest> </jar> </jar> </target> </target>
  • 46. build.xml using build.properties <target name="clean.deploy" depends="clean.build, <target name="release.sted" depends="clean.deploy" deploy.sted" description="cleans and deploys"/> description="Creates STED Production Deliverable"> <jar basedir="${BUILD_PATH}" destfile="${STED.ZIP}" <target name="undeploy" description="removes sted.jar"> excludes="**/classes/**, **/src/**, **/temp/**, $ <delete verbose="true"> {STED.ZIP}, ${STED-FULL.ZIP}"> <fileset dir="${DEPLOY_PATH}" includes="$ </jar> {STED.JAR_NAME}"/> </target> </delete> </target> <target name="release.sted-full" description="Creates STED Production Deliverable"> <target name="clean.classes" description="deletes <jar basedir="${BUILD_PATH}" destfile="${STED- classes"> FULL.ZIP}" excludes="**/classes/**, **/temp/**, $ <delete includeemptydirs="true" verbose="true"> {STED.ZIP}, ${STED-FULL.ZIP}"> <fileset dir="${CLASSES_PATH}" </jar> excludes="**/.dependency-info/**" </target> defaultexcludes="false"/> </delete> <target name="run" depends="deploy.sted" </target> description="runs sted"> <!-- WINDOWS --> <target name="clean.build" description="deletes build <!--<exec dir="${DEPLOY_PATH}" directory"> executable="sted.bat"/>--> <delete includeemptydirs="true" verbose="true"> <!-- LINUX --> <fileset dir="${BUILD_PATH}" <exec dir="${DEPLOY_PATH}" executable="./sted.sh"/> excludes="**/.dependency-info/**" </target> defaultexcludes="false"/> </delete> </project> </target>
  • 47. Summary  Ant is a cross-platform build tool for Java.  Ant uses XML based configuration file typically named 'build.xml'.  Project, Targets and Tasks − A build.xml would contain 1 project with one or more targets and each of the target containing one or more tasks.  Core and Optional tasks provided by Ant.
  • 48. Resources  Official ANT site: − http://ant.apache.org  ANT Manual: − http://ant.apache.org/manual/index.html  Wikipedia topic: − http://en.wikipedia.org/wiki/Apache_Ant  Example project: − http://sted.svn.sf.net/viewvc/sted
  • 49. ANT says Good Bye! Thank You!