File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes CruiseControl:  force building project #2 programaticaly from another project #1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "CruiseControl:  force building project #2 programaticaly from another project #1" Watch "CruiseControl:  force building project #2 programaticaly from another project #1" New topic

CruiseControl: force building project #2 programaticaly from another project #1

Riffle Chris

Joined: Feb 18, 2009
Posts: 27
Hi everyone,

I have 3 cc projects in my config.xml file: 1, 2 and 3 that I would like to have executed in order. They perform the tasks below:

1: uses <schedule> interval and <modification> element to look for changes in the repo every 180 seconds, then updates source
2: compiles source
3: performs distribution tasks

? Is it possible when #1 runs and finishes to have #1 programatically force #2 to build immediately, and then likewise have #2 run/finish then have #2 force a build of #3?

I'm kind of getting this done in a roundabout way by having #2 use the <modificationset> <buildstatus logdir="#1 logs"> approach, with the #2 <schedule interval> at 10 seconds, but I don't like this approach too much to have #2 checking the logs of #1 every 10 seconds. Maybe if I set the schedule interval of #2 to be the same or very slightly longer than the schedule interval of #1, then if #1 detected changes and ran -- # 2 would check shortly after #1 because their intervals were the same. I hope it wouldn't get confused with the intervals happening at different times to where #1 would find changes and run, while # 2 would then start waiting that long interval - (the same interval as #1 waited) instead of having #2 look for changes in #1 immediately after #1 finished running - to give the illusion of #2 being forced by #1 (which is my goal).

Thanks so much for any tips! Hope I didn't explain it poorly. Have a good day,
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Any reason you don't just make this one project with three scheduled builds? Or do you still need to build each project indepenently of the others?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Riffle Chris

Joined: Feb 18, 2009
Posts: 27
Thank you Paul for the reply.

I originally had these threes tasks (svn update, compile, deploy) in one CC project. For the <publishers> section I was using the <email> feature to let people know when that project had failed due to a compile error in the source code.

Sometimes however the project would fail for reasons with the build process itself, like being unable to connect to the svn repository or unable to delete artifacts from the previous build. The <email> feature would then send out "build failed" emails to my team - when the source code was perfect.

I decided to separate the one project into three so that the only project that would use the <email> feature to alert the team of failed builds would be my CC project with the Compile task -- thus that would be the only thing that could fail(and send an email) because Compiling is the only thing that project does.

One unfortunate functionality loss is that due to the CC Compiling project # 2 using its modification set to just look at the logs of the CC project #1 (which updates source) -- whenever CC project # 2 fails from bad java code - in the email it sends out - it only has the stack trace and doesn't show the last svn users that checked in since the last successfull compile b/c in the <email> call in project #2 I'm pointing to the logs of project #2. I tried making it point to the logs of project #1(to email the team the last people to have checked in) -- but the email message body ended up blank(I think from an inconsistency with the date/time stamps of the different logs -- and CC proj #2 just not finding the desired proj#1 log folder based on the tstamp.

I tried editing the <log> section of proj#2 to merge in the logs of proj#1, but the problem is it doesn't merge just the logs "since the last successful compile" -- but it merges ALL the logs from proj#1 -- so it would be emailing out in the email that tons of people had checked in and broke the build when it was really just one person who broke it.

Thanks to anybody with any tips! Have a good day
It is sorta covered in the JavaRanch Style Guide.
subject: CruiseControl: force building project #2 programaticaly from another project #1