Jenkins – Setup a simple Ant build project
Jenkins, previously named as Hudson, is a continuous integration tool just like CruiseControl. It has been almost 4 years since i started learning Maven which made me fall in love about best practice....
View ArticleApache Ivy – Manage dependencies for Ant build Java project
Maven is my favourite Java project management tool. But for legacy Java projects which you have to stick to use Apache Ant, you can consider Apache Ivy. Apache Ivy installation is simple, download the...
View ArticleApache Ivy – Integrate with Artifactory
Like Maven, we could setup a repository server for better dependency management. So instead of connecting to the public repository, we want our Apache Ivy project links to our repository server, i have...
View ArticleApache Ivy – Publish to Artifactory
Previously we have talked about how to work with Apache Ivy and Artifactory. Apache Ivy – Manage dependencies for Ant build Java project Apache Ivy – Integrate with Artifactory The next thing i would...
View ArticleApache Ant – Define your custom Ant Task using MacroDef
We can define custom task in Apache Ant using the <macrodef> which makes use of the <sequential> nested task as a template. Try the following build.xml and run ant to get a rough idea on...
View ArticleLinux – Wait until a specific pattern is written on log using tail and sed
In the Ant build.xml, i need to make sure the JBoss server is started before running the test cases. There are 2 possible approaches. Using twiddle.sh to check the status Monitoring server.log until...
View ArticleApache Ant – String to uppercase / lowercase using ScriptDef
In Apache Ant, we can define custom task using MacroDef. Apache Ant – Define your custom Ant Task using MacroDef Other than that, Apache Ant is now shipped with a Javascript engine so we could use...
View ArticleApache Ant – Using scp and sshexec tasks in build.xml
Unlike the Ant Contrib library which could be included thru the <taskdef>, the <scp> and <sshexec> tasks could not be included in this way or it will throw the following errors. A...
View ArticleApache Ant – Check if a file exists with wildcard
The <available> command can help you to check if a file or folder exists. Unfortunately it doesn’t support wildcard checking. Here is an workaround using the <pathconvert> such that we can...
View ArticleAnt – Stop the script without failing the build
We can use the <fail> Ant task to exit the Ant script but this will fail the build. Sometimes we may have some checking during the build such that it could exit peacefully without build failure...
View ArticleMaven – Run maven-antrun-plugin without attaching to a lifecycle phase
Long time ago, i had a post about running Ant in Maven using the maven-antrun-plugin but the Ant script would be attached to the Maven lifecycle phase. Maven – Using Ant tasks with maven-antrun-plugin...
View ArticleMaven – Run sshexec and scp in maven-antrun-plugin
If you want to use the <sshexec> or <scp> tasks in the maven-antrun-plugin, you may find the following error. [ERROR] Failed to execute goal...
View ArticleApache Ant – for loop example for reading a text file
The Ant-Contrib library also provides u a <for> task to do iteration. Here is an simple Ant example which read a text files and print it to the Ant build output. 1. This is the structure of our...
View ArticleApache Ant – Capture Ant output log using recorder task
There is a <record> task in Ant so you could save the Ant output during the Ant Build. Here is an example. 1. build.xml <project name="ant-recorder-example" default="record" basedir=".">...
View ArticleApache Ant – Error/Exception Handling
The Ant-Contrib library also provides <trycatch> task for error/exception handling. Here is an example of build.xml which demonstrate the usage and again it requires the ant-contrib-1.0b3.jar...
View ArticleApache Ant – Concatenate text files
This is an example showing how to concatenates files using Ant script. 1. Assume you have the following files in your Ant project folder. ant-for-example | - build.xml | - Text-1.txt | - Text-2.txt | -...
View ArticleApache Ant – Get and Set Ant property in Javascript when using the script task
In Ant script we could write Javascript code using the <script> task. In the following example, i will pass 2 Ant properties to Javascript and print the square value to the console. Also at the...
View ArticleApache Ant – Iteration within a specific number range
Previously i have published a post about using for loop in Ant to read a text file line by line. Apache Ant – for loop example for reading a text file The <for> task requires a list attribute...
View ArticleApache Ant – Check if a string property contains a certain string
The following example which check if a string property contains a another string. <project name="ant-string-contains-example" default="run" basedir="."> <target name="run"> <property...
View ArticleApache Ant – Missing environmental variables config in sshexec
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...
View Article