captureBuildMessages
This task captures Ant build messages and allows them to be searched or displayed, and allows conditional Ant build failures depending on whether or not a specified string is in the captured build messages.
Parameters
Attribute Description Required action The capturing action to be performed Yes. May be one of the following:
- start
- stop
- getAllMessages
- findMessage
- FailOnErrorMessagePresent
- FailOnErrorMessageMissing
MessageLevel The level of Ant build messages to capture No, default is Information. May be error, warning, information, debug, or verbose. SearchString A string to be searched for (only valid for findMessage or FailOnErrorMessagePresent or FailOnErrorMessageMissing) Yes (for search actions) PropertyMessagesName Property to receive Get/Search action Message result No, default is BuildMessages ErrorPrefixMessage A string prefix to be output before any FailOnError failure message No Examples
- Perform a projectBuild and display the build messages:
<captureBuildMessages action="start" messagelevel="information" /> <projectBuild ProjectName="myProject" /> <captureBuildMessages action="stop" /> <captureBuildMessages action="getAllMessages" propertymessagesname="BuildMessages" /> <echo message="projectBuild: build messages=${BuildMessages}" />- Search the previous build messages for a target string, and then fail if an error string is present:
<captureBuildMessages action="findMessage" searchstring="${TargetSearchString}" propertymessagesname="FoundMessages" /> <echo message="projectBuild: search found target messages=${FoundMessages}" /> <captureBuildMessages action="failOnErrorMessagePresent" searchstring="${ErrorMessageString}" />
Parent topic
Working with Ant
Related tasks
compileWorkspace
getJavacErrorCount
getProjectData
projectBuild
projectGetErrors
projectImport
projectSetBuild
projectSetImport
setDebugInfo
workspaceBuild
workspaceGetErrors
workspacePreferenceFile
workspacePreferenceGet
workspacePreferenceSet