ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Knorr <>
Subject Re: SubAnt output
Date Fri, 02 Jul 2004 07:30:00 GMT
I'm not one of the gurus but as far as I understood the mechanism the
logger has to deal with output on standard out and standard error in
addition to the builtin methods which might be called by task
In my case we had such a tool (javac) output to standard error. To
identify the correct target the project has a hashtable to recognize its
last active task/target. The responsibility to catch standard out and
standard error is with the top-level project, so the last active task to
be found is the SubAnt task. The fix delegates this to its Ant
sub-project if it is currently active and this project can now find the
according (now correct!) task.
I don't know if timing/synchronization has to be considered when
accessing the Ant sub-project at least it works in our scenario. ;)

Hope this helps,

Dominique Devienne wrote:

> Cool. Thanks for fixing this. Even though it's a bit late, I would like this
> patch to make it to 1.6.2. Does anyone object?
> But on a different note, even though I looked at the patch, I'm not sure I
> understand why adding these methods fixes the problem (as was involved in
> writing initially). I would have thought that executing the
> nested Ant would have been enough to properly nest the messages.
> Could someone savvy with the Ant logging mechanism explain/describe this
> mechanism and why this patch fixes the issue here!?
> Christian? Conor? Stefan? Antoine? Peter? Anyone?
> Thanks, --DD
> -----Original Message-----
> From: Christian Knorr
> To:
> Sent: 7/1/2004 7:00 AM
> Subject: SubAnt output
> Hi,
> I am new to this list. By browsing the archives I could not find
> anything related to my problem but forgive me if it has already been
> mentioned:
> In our hierarchical build structure we use the SubAnt task to delegate
> all tasks to our components specific build-scripts. In combination with
> CruiseControl we realized that the XML output generated by the XMLLogger
> does not represent a correct correlation of messages to tasks when using
> SubAnt:
> Buildfile: build.xml
> <?xml version="1.0" encoding="UTF-8" ?>
> <?xml-stylesheet type="text/xsl" href="log.xsl"?>
> <build error="D:\prj\test\ant\build.xml:6: Following error occured while
> executing this line
> D:\prj\test\ant\sub\build.xml:6: Compile failed; see the compiler error
> output for details." time="1 second">
> 	<target name="build" time="1 second">
> 		<task location="D:\prj\test\ant\build.xml:6: "
> name="subant" time="1 second">
> 			<message
> priority="warn"><![CDATA[D:\prj\test\ant\sub\src\ cannot
> resolve symbol]]></message>
> 			<message priority="warn"><![CDATA[symbol  :
> method printer ()]]></message>
> 			<message priority="warn"><![CDATA[location:
> class]]></message>
> 			<message priority="warn"><![CDATA[
> System.out.printer();]]></message>
> 			<message priority="warn"><![CDATA[
> ^]]></message>
> 			<message priority="warn"><![CDATA[1
> error]]></message>
> 			<target name="build" time="0 seconds">
> 				<task
> location="D:\prj\test\ant\sub\build.xml:6: " name="javac" time="0
> seconds">
> 					<message
> priority="info"><![CDATA[Compiling 1 source file]]></message>
> 				</task>
> 			</target>
> 		</task>
> 	</target>
> 	<stacktrace><![CDATA[D:\prj\test\ant\build.xml:6: Following
> error occured while executing this line
> D:\prj\test\ant\sub\build.xml:6: Compile failed; see the compiler error
> output for details.
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> ]]></stacktrace>
> </build>
> Obviously all the 'message' elements should be children of the 'javac
> task' element. It seems to me that the SubAnt task does not take care of
> the new project which is being created by its child Ant tasks.
> As a quick fix for us I patched the SubAnt task to work similar as the
> Ant task does. But instead of the 'project' variable I made the 'ant'
> variable a field which is only valid during execution of the associated
> project.
> Please let me know if there is anything else I might have missed or if
> this is the way to go. Feel free to apply the patch (which has been
> performed on Ant 1.6.1) to the Ant sources (although I guess there is a
> much cleaner way to accomplish this).
> Cheers,
> Christian
> P.S.: In addition to the patch file I also added the build files to
> reproduce the erroneous behaviour.
> ___________________________________________________________
> EADS SPACE Transportation - TE 55 - Phone: +49-421-539-5673
>  <<subAntOutputStructure.patch>>  <<ATT37308.txt>> 

EADS SPACE Transportation - TE 55 - Phone: +49-421-539-5673

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message