You are on page 1of 14

Ant

http://ant.apache.org/

Dominik koda

build.xml

XML structure

Main tag: <project>

Targets: <target>

Property: <property>

Tasks

<?xml version=1.0 encoding=utf-8 ?>


<project >
<target >

</target>
<target >

</target>
</project>

<project>

Attributes

name

default

basedir

Nested element

<description>

<project name=NAME
default=compile
basedir=.>
<description>
Popis projektu
</description>

</project>

<target>

Attributes

name

depends

description

if

unless

Nested elements

tasks

<target name=compile
depends=init
description=kompilace

</target>

<property>

Name and value

Attributes

name

Using

${property_name}

Built-in properties

basedir, ant.file, ant.version, ant.project.name,


ant.java.version, ...

<property
<property
<property
<property

name=src location=src />


name=hodnota value=dist />
file=properties.xml />
url=http://... />

Running Ant

ant [params] [target [target2 ] ]

Params

-projecthelp, -p

-propertyfile <file>

-D<property>=<name>

-buildfile <file>, -file <file>, -f <file>

Tasks

<javac>

Attributes

srcdir
destdir
classpath
encoding
source
compiler
fork

Tasks

<java>

Attributes

classname
jar
classpath
fork

Nested elements

<arg>

Tasks

<javadoc>

Attributes

sourcepath
sourcefiles
packagenames
destdir
public, protected, ,private, package
author
...

Tasks

<available>

Attributes

property
value
classname
file
resource

<available classname="org.whatever.Myclass"
property="Myclass.present"/>

Tasks

<condition>

Attributes

property
value
else

Nested elements

<not>, <and>, <or>, <xor>, <available>, ...

<condition property="javamail.complete">
<and>
<available classname="javax.activation.DataHandler"/>
<available classname="javax.mail.Transport"/>
</and>
</condition>

Tasks

<delete>

<move>

<mkdir>

<copy>

<echo>

<jar>

<unjar>

<exec>

...

You might also like