This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In my buildall.bat file I have calls to many xml files which needs to be executed. e.g oResetDatabaseLite if "%RESET_DATABASE_BUILD%" == "true" goto doResetDatabase echo dblite on EJBServer call build.bat dblite >> %PROJ_DIR%/buildall.log if errorlevel==1 goto BUILD_FAILED
:BUILD_FAILED echo . echo Build Failed - See errors echo . >> %PROJ_DIR%/buildall.log echo Build Failed - See errors >> %PROJ_DIR%/buildall.log goto end
:End cd %PROJ_DIR% echo . echo Build Over echo . >> %PROJ_DIR%/buildall.log echo Build Over >> %PROJ_DIR%/buildall.log
Here even if "build.bat dblite" call fails, My cruise control sends out a mail saying that "the build is successful" . Can you please suggest me what is that I am doing wrong or how to make the cruise control give me the correct message.
Cruise Control is ultimately just Ant, and Ant can be a little less than predictable when using exec tasks (not that they wont run, but that Ant might have no visibility their output, depending on what he executable does). My guess is that Cruise Control is successfully calling buildall.bat, which is successfully running your script though it is going to the BUILD_FAILED block. If you use a batch file to perform your build you will need to use the errorstr of the exec task to let Cruise Control find out that the build failed.
Originally posted by Paul Sturrock: Cruise Control is ultimately just Ant
Sorry, no, not at all. The only connection between CC and Ant is that CC is able to call Ant to execute Ant scripts.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I tried <exec dir="." executable="cmd" os="Windows XP" errorstr="Build Failed">
in my build file.
I couldn't put The exec part into my schedule of config.xml as it is having a reference as following <ant anthome="F:\apache-ant-1.6.2" buildfile="projectNJ.xml" target="build" uselogger="true" usedebug="true"/>
Now I'm confused. Are you executing this batch file form an Ant build file, or CruiseControl? CruseControl's documentation mention this attribute. [ December 20, 2006: Message edited by: Paul Sturrock ]
Joined: Dec 20, 2006
I am executing this batch file from an Ant build file which is being called from the schedule of config.xml of Cruise control.
Ah - so your problem is that Ant doesn't know that your batch file running the BUILD_FAILED block == the build failed, since all it cares about is that your batch file was run without error. So you need to manually find a way to let Ant know the result of the batch script. You might be able to do something with the Ant exec task's outputproperty attribute. [ December 20, 2006: Message edited by: Paul Sturrock ]
Joined: Jul 11, 2001
The most elegant way would be to have the batch file exit with an exit code != 0. Don't know how to do that, tough - if it's possible at all. Perhaps the "exit" command accepts a parameter?
If you have are able to do that, you only need to add failonerror attribute to the Ant task.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Cruise control giving wrong status in email.