The Ant-Contrib library is a must have tool if you need to have more control on your build flow. Here is another example on using the propertyRegex task provided by Ant-Contrib to select or replace a string from an input.
The Ant <exec> task allows us to run shell command in Ant script. We could provide input arguments like the following example which prints today’s weekday.
build.xml
It works quite well, but then i realize if there is error in the grunt execution, Ant will still mark the Ant build successful and this may lead to some downstream failure in a continuous integration workflow. Continue reading Ant – Execute Grunt and fail it on error→
I am trying to figure out which Apache Ant version is running on the Jenkins server. Starting from Apache Ant 1.7.0, you can make use of the <Antversion> task to determine the running Ant version. The following is a simple build.xml which could serve this purpose.
<project name="ant-antversion-example" default="run" basedir=".">
<target name="run">
<echo message="Checking ANT version ..."/>
<antversion property="antversion"/>
<echo message=" version: ${antversion}"/>
</target>
</project>
The <sshexec> task is a very handle tool for executing command on the server through SSH. But i find that the SSH session does not have the proper environmental variables. Here is a simple solution.
The <for> task requires a list attribute containing a comma separated string. Here is an example.
<echo message="The first five letters of the alphabet are:"/>
<for list="a,b,c,d,e" param="letter">
<sequential>
<echo>Letter @{letter}</echo>
</sequential>
</for>