subir bhaumik wrote:
Hi
I am not getting reply on ant user forum that's why i am posting here.
I am using ant API programmatically for build rather than writing build.xml.
It's o.k. Now i want the compilation record in a log file.I can get it by
writing the following in build.xml.
<target name="compile" depends="init"
description="compile the source " >
<record name="record-log.txt" action="start"/>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
<record name="record-log.txt" action="stop"/>
</target>
What i get in the output file "record-log.txt" i want that file to be
generated not using build.xml but using ant API programmatically.
For that I have tried Recorder class.
The code snippet
======================================================================================
Recorder rec = new Recorder();
rec.setName("D:/subir/Downloads/example1/log.txt");
Recorder.ActionChoices reacch = new Recorder.ActionChoices();
reacch.setValue("start");
rec.setProject(p);
rec.execute();
reacch.setValue("stop");
========================================================================================
The log file looks like :
======================================================================================
compile:
[javac] Compiling 16 source files to C:\bishwakarma\builttemp\classes
BUILD FAILED
Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:938)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at buildadmin.Build.doGet(Build.java:413)
at buildadmin.Build.doPost(Build.java:543)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
=================================================================
But i want log like :
============================================================================
compile:
[javac] Compiling 4 source files to D:\subir\Downloads\example1\build
[javac] D:\subir\Downloads\example1\src\Adder.java:16: ';' expected
[javac] }
[javac] ^
[javac] 1 error
That output comes from javac, which uses stdout or stderror for its
outoput. I dont know how that gets merged with the recorder stuff
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]