Friday, November 16, 2007

Random build failures with maven

Some builds are seemingly failing at random, the cause is the fact that maven is downloading corrupted jar files during build time. A possible cause for this is network timeout.

What I am planning to do to correct for this is to try rebuilding the portal up to 3 times if the build fails. Below is script code for how to detect build failures and rebuild if necessary.
The key line is: "if test $? -ne 0; then"
This detects a maven build failure.


maven-2.0.7/bin/mvn -e clean install

if test $? -ne 0; then
echo ----------- MAVEN BUILD FAILED, TRYING AGAIN.. ATTEPMT 1 -----------
maven-2.0.7/bin/mvn -e clean install
fi

if test $? -ne 0; then
echo ----------- MAVEN BUILD FAILED, TRYING AGAIN.. ATTEPMT 2 -----------
maven-2.0.7/bin/mvn -e clean install
fi


if test $? -ne 0; then
echo ----------- MAVEN BUILD FAILED, TRYING AGAIN.. ATTEPMT 3 -----------
maven-2.0.7/bin/mvn -e clean install
fi


if test $? -ne 0; then
echo ----------- MAVEN BUILD FAILED, EXITING -----------
exit 0
fi

Thursday, November 1, 2007

Crontab

To get an NMI build running nightly, use a crontab as such:

1) Type:
> crontab -e
2) Enter the following into the crontab file:

MAILTO=youremail@domain.com
20 12 1 11 4 (. /nmi/bin/config.sh && nmi_submit <$HOME/yoursubmitfile.submit>)


The above crontab entry runs "nmi_submit <$HOME/yoursubmitfile.submit>" at 12:20noon, 1st day of the month, november (11), at 4th day of the week (thursday).
Consult this webpage for more details about cron: http://www.adminschoice.com/docs/crontab.htm