[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-ant-dev] AntHelper example and capturing output
|
Thanks for your reply - I tried what you suggested, but I cannot quite
get it to work.
Firstly, the code in the AntHelper class (see
http://dev.eclipse.org/newslists/news.eclipse.platform/msg35076.html )
that I am modifying is as follows:
public ILaunch execute( IProgressMonitor monitor) throws CoreException {
ILaunchManager launchManager =
DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type =
launchManager.getLaunchConfigurationType(IAntLaunchConfigurationConstants.ID_ANT_LAUNCH_CONFIGURATION_TYPE);
String name =
launchManager.generateUniqueLaunchConfigurationNameFrom( antFile.getName());
ILaunchConfigurationWorkingCopy workingCopy=type.newInstance(null,
name);
workingCopy.setAttribute( IExternalToolConstants.ATTR_CAPTURE_OUTPUT,
true);
workingCopy.setAttribute( IExternalToolConstants.ATTR_SHOW_CONSOLE,
true);
workingCopy.setAttribute( IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTIES, userProperties);
workingCopy.setAttribute( IExternalToolConstants.ATTR_TOOL_ARGUMENTS,
toolArguments );
workingCopy.setAttribute( IExternalToolConstants.ATTR_LOCATION,
antFile.getAbsolutePath());
workingCopy.setAttribute( IExternalToolConstants.ATTR_WORKING_DIRECTORY,
workingDir.getAbsolutePath());
workingCopy.setAttribute( IDebugUIConstants.ATTR_PRIVATE, true);
workingCopy.setAttribute( IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND,
false);
return workingCopy.launch( "run", monitor);
}
where I have set the variable toolArguments to "-listener
net.kjames.AntBuildListener
AntBuildListener is the class I wrote to redirect messages to my
existing console, and it implements org.apache.tools.ant.BuildListener.
What I am seeing now is that in my runtime workbench the build is
running, I still get an Ant console named as the build file, but I get
no output in that window *or* my console window. I get no error messages
in my main workbench (I was expecting some kind of exception message if
there was a problem, such as classpath issues or something).
Do I need to add my plugin JAR to Ants' classpath somehow? I have seen
other posts on related topics about separate classloaders, but I go all
light-headed when people talk about classloaders :)
Cheers,
Kev.
On Thu, 2005-01-20 at 12:46 -0800, Darin Swanson wrote:
>
> I am not familiar with the particulars of the AntHelper but I can help
> you with setting additional build listeners.
>
> The semantics of these arguments are defined by Apache Ant not
> Eclipse.
> Therefore these are just tool arguments and should be specified in the
> working copy using IExternalToolConstants.ATTR_TOOL_ARGUMENTS. See
> the ExternalToolsMainTab.
>
> You can only have one logger (which you can change away from the
> AntProcessBuildLogger...but you will lose the Console integration
> etc.) but you can specify any number of listeners.
> Specifying a listener should be all you require:
> configuration.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, "-listener your.cool.Listener");
>
> In 3.1 you can specify any launch configuration to log to a
> file...have/can you consider this approach? See the implementation in
> the org.eclipse.debug.ui.CommonTab
>
> HTH
> Darins