FYI ant outputs System.out at "INFO" level and System.err at "WARN" level. This can be shown as follows: redirect.xml:
<project xmlns:ac="antlib:net.sf.antcontrib"> <ac:shellscript shell="python"> import sys sys.stdout.write("stdout\n") sys.stderr.write("stderr\n") </ac:shellscript> </project>
ant -f redirect.xml -logger org.apache.tools.ant.XmlLogger
<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/xsl" href="log.xsl"?>
<build time="0 seconds"> <task location="jar:file:/home/preilly/corvil/MED/ant/lib/ant-contrib.jar!/net/sf/antcontrib/antlib.xml:1: " name="" time="0 seconds"></task> <task location="/home/preilly/learning/ant/redirect.xml:2: " name="ac:shellscript" time="0 seconds"> <message priority="info"><![CDATA[stdout]]></message> <message priority="warn"><![CDATA[stderr]]></message> <message priority="warn"><![CDATA[]]></message> <message priority="info"><![CDATA[]]></message> </task> </build>
However to support error line/file detection you need to use an ide - emacs, jedit can parse the output for javac generated errors when ant is called with the -emacs flag. netbeans (at least in version 3.6) can process the errors without the -emacs flag.
All of these use a regex matching of the output stream to detect the errors (and file/linenumber).
Peter
Digambar, Shaligram (Consultant) wrote:
Had ANT logged system.err at different level than system.out it would have been easier to redirect the error output to a separate file and generate better build reports. If its tricky as you've mentioned, we need to find a workaround. Has anyone already done this?
Thanks, Shaligram
As I mentioned before, the default compilers are
called within the VM and do not provide a
comprehensive call interface. Ant has no control over
their output; it wouldn't be logged at all if Ant
didn't override System.out and System.err to go to its
own log stream. It might be possible to re-override
System.err to log at ERROR level for the duration of
<javac>'s execute() method, but it could get tricky. Again, I think the answer here is to implement output
redirection for <javac> provided an externally called
compiler type is used, but it'll be awhile.
-Matt
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
----------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]