From: Tony Cook
Sent: Tuesday, January 06, 2004 7:16 AM
Hi I've just a few minutes ago got CC upgraded to Ant 1.6.0. The best way is to use the antscript attribute on the <ant> builder tag to point to a shell script that starts and runs the ant of your choice. This way is so easy and doesn't require you to drop Ant jars into CruiseControl. Jtf has detailed this a number of times. Here Jtf's info again
From: Jeffrey Fredrick
Subject: RE: Using a Script (was RE: Build loop hangs )
Use the ''antscript'' attribute on AntBuilder: http://cruisecontrol.sourceforge.net/main/configxml.html#ant
You'll probably want to use it in combination with the antworkingdir attribute.
As an example of using that I run CC against one of our projects like so:
<schedule interval="1800">
<ant antscript="e:/projectPath/build.bat"
antworkingdir="/projectPath"
uselogger="false"
target="vssget all" />
</schedule>
The build.bat is the same one I use when running from the command-line:
The %* as a param to ant.bat is important – it means that all the arguments to build.bat are passed along to ant.bat. If I were to skip that then CC wouldn't work properly.
Jtf
unix version:
Note the double quotes around $@: this ensures that all arguments will be quoted, which is necessary for arguments containing spaces. CruiseControl passes a default attribute (cvstimestamp) containing a space since version 2.1.6, so you'll definitely need this if you're using a version 2.1.6 or later.
from Jerome Lacoste:
This also works for me with CC 2.1.6:
JAVA_HOME=/usr/local/lib/jdk1.5.0 /usr/local/lib/maven-1.0/bin/maven "$@"
from Tony Cook:
...
2) More memory/speed streamlining was achieved by switching to running Ant in a separate JVM process via the ant builder antscript attribute. When the out of process Ant finishes, you naturally get all its memory back before CC goes to sleep. As an aside this switch dropped my build times from 18 minutes to 6 minutes, so I highly recomment this approach
. Also this method has allowed me to painlessly switch to Ant 1.6.0 today.
...
The most likely reason for the speed up is the out-of-process Ant starts with a clean unfragmented heap, whereas running Ant within the CC process (which is continuously running) means that the heap is usually in some less efficient state depending on whether a garbage collect has recently been done (if at all
)
Note from Joris: this is not true; CruiseControl always runs the Ant build in a separate JVM process, even if it's using the Ant version that's bundled with the distribution. It's still highly advisable to use the antscript attribute, however!
Note that you don't have to write a custom script to make use of the antScript-attribute. For instance, under Windows, you could use something like this to use Ant 1.6.1:
<ant antscript="C:\Java\apache-ant-1.6.1\bin\ant.bat"
buildfile="MyProject-nightlybuild.xml"
uselogger="true"
time="2300"/>
And now the new anthome attribute offers an alternative to specifying the script. Set anthome and CC will try and use the script that came w/ant automagically.
Frequently Asked Questions