ant script

build.xml

<project name="testAntFile" default="build" basedir=".">
<target name="build" description="test build">
<echo message="hello"/>
</target>
</project>

default call to `build.xml`, otherwise we have to specify the file

 $ ant -file test.xml

call to particular target

default target name is `build`

<target name="buildname">...
$ ant buildname

passing variable

$ ant -Dparam1=whatever,will,be,will,be 

build.xml

${param1}

example

<project name="testAntFile" default="build" basedir=".>

<description>Whatever</description>
<target name="build" description="test build">
<zip destfile="D:\VirtualBoxSharedFolder\antTest\testZip.zip" basedir="D:\VirtualBoxSharedFolder\antTest\testZip" includes="**/*">
<fileset dir="D:\VirtualBoxSharedFolder\antTest\testZip">
<modified>
<param name="cache.cachefile" value="localdev.cache"/>
</modified>
</fileset>
</zip>
</target>
</project>

after that localdev.cache will be created in the build.xml folder

ref : https://ant.apache.org/manual/Types/selectors.html#modified

import

<import file="whatever/build.xml"/>

property

<property file="whatever.properties" />

whatever.properties

whatever.var1 = /what/ever/param.s

or

<property name="what.ever.param" value"${another.param}/${whatever}" />

or

<loadfile property="whatever.property" srcFile="whatever/file"/>

whatever/file

10/25/16 19:36

or

<loadfile property="whatever.prop" srcfile="whateversource"> <filterchain> 		<linecontainsregexp> <regexp pattern='myPattern'/> </linecontainsregexp> </filterchain> </loadfile>

echo

<echo message="whatever"/>
<echo>to echo</echo>
<echo file="echo/to/file">to echo</echo>

option : append=”true”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s