Console output delay using AntRunner [message #300608] |
Mon, 13 March 2006 20:27 |
Eclipse User |
|
|
|
Originally posted by: adam.lundberg.gmail.com
I have implemented a build function that uses the AntRunner to execute an ANT script. I provide the ANT runner with my own implementation of the BuildLogger and make sure that my BuildLogger resides in a seperate jar-file. My BuildLogger prints the build output to the Console. Everything works fine except that the output from the ANT script is displayed when the script has finished. The build process takes a long time so I need the output to display in "real-time".
This is how the AntRunner is invoked:
public void run(IProgressMonitor monitor) {
String logfileName = getLogFile();
//Instanciate an AntRunner. This will handle the execution of the ANT script
AntRunner runner = new AntRunner();
//retrieve the ANT build file
runner.setBuildFileLocation(buildFile.getLocation().toOSStri ng());
//Log ANT output to file
runner.addBuildLogger("se.dupclipse.build.logger.AntBuildLogger ");
IPath logFilePath = project.getLocation();
String stringLogFilePath = "\"" + logFilePath.append(logfileName).toFile().toString()+ "\"";
//runner.setArguments("-logfile " + stringLogFilePath );
runner.setMessageOutputLevel(Project.MSG_VERBOSE);
try {
monitor.beginTask("Building project...", 100);
monitor.setTaskName("Build DUP project " + type);
monitor.worked(10);
runner.run(monitor);
monitor.worked(90);
} catch (CoreException e) {
System.out.println("Problem running ANT script");
DUPclipsePlugin.log(e);
monitor.setCanceled(true);
}
monitor.done();
}
The BuildLogger and ConsoleViewer looks very much like what Gary Mohr has implemented. (http://www.eclipsezone.com/eclipse/forums/m91923447.html)
What do I need to do to get the output to appear in the console at the actual execution of the ANT script and not after execution?
/Adam
|
|
|
Powered by
FUDForum. Page generated in 0.02836 seconds