ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <anto...@antbuild.com>
Subject Re: How to redirect javac task errors to a separate file
Date Wed, 11 Feb 2004 22:50:12 GMT
Digambar, Shaligram (Consultant) wrote:

>I don't think it is an IDE feature. It could be easily incorporated in ant.
>Consider following example where I have deliberately introduced compiler
>error.
>
>when I run "c:\build>javac testMe.java 2> error.txt" from DOS command line I
>get following output
>
>"testMe.java:3: class test is public, should be declared in a file named
>test.java
>public class test
>       ^
>1 error"
>
>
>whereas if I use ant <javac> task I get following output:
>
>init:
>     [echo] ------------Using javac to compile source file---------
>    [javac] Since fork is true, ignoring compiler setting.
>    [javac] Compiling 1 source file to C:\shali\newJRE\build
>    [javac] depend attribute is not supported by the modern compiler
>    [javac] Since fork is true, ignoring compiler setting.
>    [javac] [parsing started C:\shali\newJRE\build\testMe.java]
>    [javac] [parsing completed 453ms]
>    [javac] C:\build\testMe.java:3: class test is public, should be declared
>in a file named test.java
>    [javac] public class test
>    [javac]        ^
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Object.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/String.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/util/Vector.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Thread.class)]
>    [javac] [checking test]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/System.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/PrintStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/FilterOutputStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/OutputStream.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Integer.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Number.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/util/AbstractList.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/util/AbstractCollection.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/DataInputStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/ByteArrayInputStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/InputStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/FilterInputStream.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Exception.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Throwable.class)]
>    [javac] [loading C:\jdk1.3.1_10\jre\lib\rt.jar(java/net/Socket.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/net/InetAddress.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/net/SocketImpl.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/EOFException.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/io/IOException.class)]
>    [javac] [checking Server]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/lang/Runnable.class)]
>    [javac] [loading
>C:\jdk1.3.1_10\jre\lib\rt.jar(java/net/ServerSocket.class)]
>    [javac] [total 5891ms]
>    [javac] 1 error
>
>BUILD FAILED
>file:C:/build/test.xml:7: Compile failed; see the compiler error output for
>details.
>
>Total time: 19 seconds
>
>
>Clearly the ant output has lots of information and it is very difficult to
>locate actual compilation error. In our actual project we have more than
>3000 classes. You can imagine how the output will look with ant! Developers
>will have hard time locating compilation errors with the output like that!!
>Its very unfortunate for the tool like ant to lack feature of providing
>useful build reports to developers.
>For now I will make use of <exec> to launch a shell script that summarises
>error output in nice html files that provide link to actual source code.
>
>
>Thanks,
>Shaligram
>
>Phone: (401)392-7948
>Fax:(401)392-4974/4975
>
>
>-----Original Message-----
>From: Matt Benson [mailto:gudnabrsam@yahoo.com]
>Sent: Wednesday, February 11, 2004 5:14 PM
>To: Ant Users List
>Subject: RE: How to redirect javac task errors to a separate file
>
>
>--- "Digambar, Shaligram  (Consultant)"
><Shaligram.Digambar@GTECH.COM> wrote:
>  
>
>>It would be nice to provide following features for
>>the javac task in future
>>releases
>>
>>-separation of output based on levels-it can be html
>>file.
>>-ability to provide compiler error links to actual
>>source code
>>    
>>
>
>Sounds like you want an IDE.  Exactly what output are
>you getting from the command line that you can't get
>with <javac> or <exec>?
>
>-Matt
>
>  
>
Shaligram, you have the option  to develop a custom Logger in Java which 
you run ant with.
In this case you can parse the output of javac the way that suits you. 
There might even be some samples of such loggers that other users have 
posted.
look in the mail archives.

Antoine


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message