At line 3 changed 1 line. |
<div class="note" style="margin: 5px">__NOTE:__ The main lesson I learned when trying to get this to work is don't use Cygwin. In fact, I recommend you use a *nix machine if you [have one available|http://www.clarkware.com/cgi/blosxom/2004/10/19#TheyNeedABuildMachine] |
<div class="note" style="margin: 5px">__NOTE:__ I recommend setting up CruiseControl on a Linux machine if you [have one available|http://www.clarkware.com/cgi/blosxom/2004/10/19#TheyNeedABuildMachine] |
At line 8 changed 1 line. |
1. [Download||http://prdownloads.sourceforge.net/cruisecontrol/cruisecontrol-2.2.zip?download] and install CruiseControl. Extract it to your $TOOLS_HOME directory, wherever that may be. |
1. [Download|http://cruisecontrol.sourceforge.net/download.html] and install CruiseControl 2.4.1. Extract it to your $TOOLS_HOME directory, wherever that may be. |
At line 10 changed 1 line. |
2. After you've installed CruiseControl, create an "appfuse-cc" or similar directory next to your project directory. In my tests, I had: |
2. After you've installed CruiseControl, download the following files and put them in the cruisecontrol-2.4.1 ($CC_HOME) directory. |
At line 12 added 24 lines. |
* [build.xml] |
* [config.xml] |
|
The latest version of these files can be found [in CVS|https://appfuse.dev.java.net/source/browse/appfuse/extras/cruisecontrol] or in your project's ''extras/cruisecontrol'' directory. |
|
3. Modify config.xml for your e-mail address and project name. |
|
4. Modify build.xml so it points to your CVS server and project. |
|
5. Run "ant" in the current directory or checkout your project into the "projects". |
|
6. Run cruisecontrol.bat (Windows) or cruisecontrol.sh (Unix). |
|
%%note __NOTE:__ If you're using Subversion instead of CVS, [download svnant|http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=1731]. Extract the download into your ''work'' directory, delete everything but it's "lib" directory and adjust the path in build.xml accordingly.%% |
|
I was puzzled why my HTML E-Mails didn't contain all the pretty formatting like Spring's does. Then I looked at their [latest archived one|http://article.gmane.org/gmane.comp.java.springframework.devel/6300] and noticed it looks the same on Gmane as it does in GMail. I'd recommend sending your build notifications to an e-mail account that can be read with a good HTML e-mail reader. |
|
If you want to use CruiseControl to build your [Equinox|https://equinox.dev.java.net] project, that's in [Equinox's CVS|https://equinox.dev.java.net/source/browse/equinox/extras/cruisecontrol]. |
|
!!Setup CruiseControl Daemon |
After getting all the above working, I setup CruiseControl to run as a daemon. I has some issues with getting [these instructions|http://confluence.public.thoughtworks.org/display/CC/RunningCruiseControlFromUnixInit] working, so I [pinged the mailing list|http://www.nabble.com/forum/ViewPost.jtp?post=3195390&framed=y]. After a few back-and-forth e-mails, the following solution worked for me on Suse 10. |
|
* Create an /etc/init.d/cruisecontrol script with the following script. Make sure and chmod +x /etc/init.d/cruisecontrol. |
<div style="margin-left: 40px"> |
At line 13 changed 4 lines. |
c:\Source |
c:\Source\appfuse |
c:\Source\appfuse-cc |
}}} |
#!/bin/sh |
#content of /opt/cruisecontrol/init script |
# chkconfig: 345 99 05 |
# description: CruiseControl build loop (see /home/tools) |
At line 18 changed 1 line. |
3. Download the following files and put them in the "appfuse-cc" directory: |
# based on http://confluence.public.thoughtworks.org/display/CC/RunningCruiseControlFromUnixInit |
# adapted for multiple projects |
At line 20 changed 4 lines. |
* [build.xml] |
* [buildstatus.xsl] |
* [config.xml] |
* [cruise.sh] |
# |
# Cruise Control startup: Startup and kill script for Cruise Control |
# |
At line 25 changed 1 line. |
The latest version of these files can be found [in CVS|https://appfuse.dev.java.net/source/browse/appfuse/extras/cruisecontrol]. |
PATH=/sbin:/usr/sbin:/usr/bin:/bin |
export PATH |
At line 27 changed 1 line. |
4. Modify cruise.sh to point to the installed directory. If you're on Windows, rename cruise.sh to cruise.bat and point to the cruisecontrol.bat file. |
NAME=cruisecontrol |
DESC="CruiseControl 2.2 continuous integration build loop" |
At line 29 changed 3 lines. |
5. Modify config.xml for your Ant path and publishing directories. |
|
6. Modify build.xml so it points to your CVS server and project. |
CC_USER=mraible |
CC_WORK_DIR=/opt/tools/cruisecontrol |
CC_INSTALL_DIR=/opt/tools/cruisecontrol |
At line 33 changed 1 line. |
7. Run "ant" in the current directory or checkout your project into the "checkout" directory (you'll need to create it). You can also run this on the "appfuse" project for testing purposes. |
CC_DAEMON=$CC_INSTALL_DIR/cruise.sh |
CC_CONFIG_FILE=$CC_WORK_DIR/config.xml |
CC_LOG_FILE=$CC_WORK_DIR/cruisecontrol.log |
CC_PORT=8082 |
CC_RMIPORT= |
CC_COMMAND="$CC_DAEMON -configfile $CC_CONFIG_FILE -port $CC_PORT -rmiport $CC_RMIPORT" |
At line 35 changed 1 line. |
8. Create a "logs/appfuse" directory in the current directory. |
# overwrite settings from default file |
if [ -f /etc/default/cruisecontrol ]; then |
. /etc/default/cruisecontrol |
fi |
At line 37 changed 1 line. |
9. Run "cruise.sh". |
test -f $CC_DAEMON || exit 0 |
At line 39 changed 1 line. |
10. Tweak the publishers in config.xml to your heart's content. |
if [ `id -u` -ne 0 ]; then |
echo "Not starting/stopping $DESC, you are not root." |
exit 4 |
fi |
At line 78 added 2 lines. |
# PPID is read-only in my shell - GNU bash, version 2.05b.0(1)-release (i586-mandrake-linux-gnu) |
PARPID=`ps -ea -o "pid ppid args" | grep -v grep | grep "${CC_DAEMON}" | sed -e 's/^ *//' -e 's/ .*//'` |
At line 42 changed 1 line. |
I was puzzled why my HTML E-Mails didn't contain all the pretty formatting like Spring's does. Then I looked at their [latest archived one|http://article.gmane.org/gmane.comp.java.springframework.devel/6300] and noticed it looks the same on Gmane as it does in GMail. I'd recommend sending your build notifications to an e-mail account that can be read with a good HTML e-mail reader. |
if [ "${PARPID}" != "" ] |
then |
PID=`ps -ea -o "pid ppid args" | grep -v grep | grep java | grep "${PARPID}" | \ |
sed -e 's/^ *//' -e 's/ .*//'` |
fi |
At line 44 changed 1 line. |
If you want to use CruiseControl to build your [Equinox|https://equinox.dev.java.net] project, that's in [Equinox's CVS|https://equinox.dev.java.net/source/browse/equinox/extras/cruisecontrol]. |
case "$1" in |
|
'start') |
# going into the work dir allows for use of relative PATHs in the config file |
cd $CC_WORK_DIR |
su $CC_USER -c "$CC_COMMAND >> $CC_LOG_FILE 2>&1" & RETVAL=$? |
echo "$NAME started with jmx on port ${CC_PORT}" |
;; |
At line 46 changed 2 lines. |
!!Can you test all of AppFuse? |
When I try to run the attached [build-appfuse.xml] on my Mac and Linux machines, I get OutOfMemory errors. My PowerBook has ANT_OPTS set to "-Xmx768m" and my Fedora Core 3 box has it set to "-Xms1024M -Xmx1024M". It actually dies a lot sooner on Linux, and the PowerBook gets ''really'' close to finishing. The full build and test takes about 45 minutes. There are currently 21 AppFuse combinations tested by this script. Spring is used in all of these, so I've eliminated that as a listed option. |
'stop') |
if [ "${PID}" != "" ] |
then |
kill -9 ${PID} ${PARPID} |
$0 status |
RETVAL=$? |
else |
echo "$NAME is not running" |
RETVAL=1 |
fi |
;; |
At line 49 changed 1 line. |
NOTE: If you're trying this on Windows, remove the "fixcrlf" call at the beginning of the "test" target. |
'status') |
# echo PARPIDs $PARPID |
# echo PIDs $PID |
kill -0 $PID >/dev/null 2>&1 |
if [ "$?" = "0" ] |
then |
echo $NAME \(pids $PARPID $PID\) is running |
RETVAL=0 |
else |
echo "$NAME is stopped" |
RETVAL=1 |
fi |
;; |
At line 51 changed 22 lines. |
# Struts + Hibernate |
# Struts + Hibernate and iBATIS |
# Struts + iBATIS |
# Struts with AppGen - Generic |
# Struts with AppGen - Detailed |
# Spring MVC + Hibernate |
# Spring MVC + iBATIS |
# Spring MVC with AppGen - Generic |
# Spring MVC with AppGen - Detailed |
# WebWork + Hibernate |
# WebWork + iBATIS |
# WebWork with AppGen - Generic |
# WebWork with AppGen - Detailed |
# JSF + Hibernate |
# JSF + iBATIS |
# JSF with AppGen - Generic |
# JSF with AppGen - Detailed |
# Tapestry + Hibernate |
# Tapestry + iBATIS |
# Tapestry with AppGen - Generic |
# Tapestry with AppGen - Detailed |
---- |
'restart') |
$0 stop && $0 start |
RETVAL=$? |
;; |
|
*) |
echo "Usage: $0 { start | stop | status | restart }" |
exit 1 |
;; |
esac |
#echo ending $0 $$.... |
exit 0; |
}}} |
</div> |
|
That's it - you should be able to run /etc/init.d/cruisecontrol as root and CC will check for new updates every hour. |