AntRunner and Console output [message #11008] |
Thu, 01 May 2003 12:54  |
Eclipse User |
|
|
|
----copied from eclipse.tools newsgroup-----
I also tried using AntProcessBuildLogger, as Darin suggested, copying
the call sequence from AntLaunchDelegate, and ended up with the same
results as Anders -- no Console output.
Anyone figure this out besides Anders (I sent him a request for his
solution, but haven't heard back from him yet).
Thanks,
Doug
Anders Nilsson wrote:
> I figured it out based on, but not using Darin's suggestion.
>
> The solution is a bit complex to post. If someone needs help, contact me
> directly.
>
> Anders
>
> "Anders Nilsson" <anders.nilsson@ibs.no> wrote in message
> news:b5ppsp$mmi$1@rogue.oti.com...
>
>> I tried to use the logger you sugessted, and I also looked in the
>> AntLaunchDelegateClass. From the latter I relaized I needed to set the
>> process ID.
>>
>> I still get no output. My code now looks like this:
>>
>> // link the process to its build logger via a timestamp
>>
>> long timeStamp = System.currentTimeMillis();
>> String idStamp = Long.toString(timeStamp);
>> String idProperty = "-D" + AntProcess.ATTR_ANT_PROCESS_ID + "=" +
idStamp;
>> //$NON-NLS-1$ //$NON-NLS-2$
>>
>>
>> // Set the arguments
>>
>> arguments =
>> " -Dtarget.project=" + projectPath +
>> " -Dsource.project=" + projectPath +
>> " -Dxdoclet.jar.path=" + pluginRoot + xdocletJarPath +
>> " -Dant.jar.path=" + antJarPath +
>> " -Dj2ee.jar.dir=" + jbossHome + "\\client" +
>> " " + idProperty;
>>
>>
>> try {
>>
>> AntRunner runner = new AntRunner();
>> runner.setBuildFileLocation(buildfile);
>> runner.setArguments(arguments);
>>
>
>
runner.addBuildLogger("org.eclipse.ui.externaltools.internal.ant.logger.AntP
>
>> rocessBuildLogger");
>> // runner.addBuildLogger("org.apache.tools.ant.DefaultLogger");
>> runner.run(pm);
>>
>> } catch (CoreException e) {
>> e.printStackTrace();
>> }
>>
>> Do anyone have any hints ?
>>
>> Regards
>>
>> Anders
>>
>>
>> "Darin Swanson" <Darin_Swanson@us.ibm.com> wrote in message
>> news:b5nhlu$vti$1@rogue.oti.com...
>>
>>> You can make use of the build logger that is provided with Eclipse.
>>>
>
> " org.eclipse.ui.externaltools.internal.ant.logger.AntProcessB uildLogger ".
>
>> Of
>>
>>> course as it is an internal class it comes with no guarantees
>>> To fully mimic the how Eclipse does its Ant support take a look at the
>>>
>>
>
org.eclipse.ui.externaltools.internal.ant.launchConfiguratio ns.AntLaunchDele
>
>>> gate class
>>>
>>> HTH
>>> Darins
>>>
>>> "Anders Nilsson" <anders.nilsson@ibs.no> wrote in message
>>> news:b5mkq8$92i$1@rogue.oti.com...
>>>
>>>> Hello,
>>>>
>>>> Using 2.1 RC2, I have written a plug-in that uses AntRunner to run an
>>
>>
>> Ant
>>
>>>> script. In the plug in development environment, I can get the output
>>
>>
>> from
>>
>>>> ant to display in the console of the development workbench by using:
>>>>
>>>> runner.addBuildLogger("org.apache.tools.ant.DefaultLogger");
>>>>
>>>> I would like to get the output displayed to the Console (or somewhere
>>
>>
>> else
>>
>>>> convenient) of the runtime workbench (actually to have users of the
>>>
>>>
>>> plug-in
>>>
>>>> see the output). How can this be achieved ? Do I have to write a
>
>
> custom
>
>>>> logger ?
>>>>
>>>> Thanks,
>>>>
>>>> Anders
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
|
|
|
|
|
|
Re: AntRunner and Console output [message #12382 is a reply to message #11008] |
Fri, 02 May 2003 14:23  |
Eclipse User |
|
|
|
I gave up on using AntRunner directly -- never could get a BuildLogger
implementation to display output to the Console view. However, the
solution to my problem came when I abandoned this path and instead used
the AntLaunchShortcut class from the
org.eclipse.ui.externaltools.internal.ant.launchConfiguratio ns package.
It was simple...here's the crux of the solution (adapted from the
RunTargetAction class of the
org.eclipse.ui.externaltools.internal.ant.view.actions package):
IFile file= AntUtil.getFile("myBuildFile.xml");
AntLaunchShortcut shortcut= new AntLaunchShortcut();
shortcut.launch(file, ILaunchManager.RUN_MODE, null);
The AntLaunchShortcut class ends up constructing an ILaunchConfiguration
object for your build file, then uses DebugUITools.launch() to execute
it. The Console view is automatically opened to show output, if
necessary. You could extend AntLaunchShortcut.launch() if you wanted to
modify the configuration settings before executing the build file.
Also, in order to use this solution, the "org.eclipse.debug.core",
"org.eclipse.debug.ui", and "org.eclipse.ui.externaltools" plugins must
be referenced in the <requires> section of your plugin.xml.
Doug
Doug Spelce wrote:
> ----copied from eclipse.tools newsgroup-----
>
> I also tried using AntProcessBuildLogger, as Darin suggested, copying
> the call sequence from AntLaunchDelegate, and ended up with the same
> results as Anders -- no Console output.
>
> Anyone figure this out besides Anders (I sent him a request for his
> solution, but haven't heard back from him yet).
>
> Thanks,
> Doug
>
> Anders Nilsson wrote:
>
> > I figured it out based on, but not using Darin's suggestion.
> >
> > The solution is a bit complex to post. If someone needs help, contact me
> > directly.
> >
> > Anders
> >
> > "Anders Nilsson" <anders.nilsson@ibs.no> wrote in message
> > news:b5ppsp$mmi$1@rogue.oti.com...
> >
> >> I tried to use the logger you sugessted, and I also looked in the
> >> AntLaunchDelegateClass. From the latter I relaized I needed to set the
> >> process ID.
> >>
> >> I still get no output. My code now looks like this:
> >>
> >> // link the process to its build logger via a timestamp
> >>
> >> long timeStamp = System.currentTimeMillis();
> >> String idStamp = Long.toString(timeStamp);
> >> String idProperty = "-D" + AntProcess.ATTR_ANT_PROCESS_ID + "=" +
> idStamp;
> >> //$NON-NLS-1$ //$NON-NLS-2$
> >>
> >>
> >> // Set the arguments
> >>
> >> arguments =
> >> " -Dtarget.project=" + projectPath +
> >> " -Dsource.project=" + projectPath +
> >> " -Dxdoclet.jar.path=" + pluginRoot + xdocletJarPath +
> >> " -Dant.jar.path=" + antJarPath +
> >> " -Dj2ee.jar.dir=" + jbossHome + "\\client" +
> >> " " + idProperty;
> >>
> >>
> >> try {
> >>
> >> AntRunner runner = new AntRunner();
> >> runner.setBuildFileLocation(buildfile);
> >> runner.setArguments(arguments);
> >>
> >
> >
> runner.addBuildLogger("org.eclipse.ui.externaltools.internal.ant.logger.AntP
>
> >
> >> rocessBuildLogger");
> >> // runner.addBuildLogger("org.apache.tools.ant.DefaultLogger");
> >> runner.run(pm);
> >>
> >> } catch (CoreException e) {
> >> e.printStackTrace();
> >> }
> >>
> >> Do anyone have any hints ?
> >>
> >> Regards
> >>
> >> Anders
> >>
> >>
> >> "Darin Swanson" <Darin_Swanson@us.ibm.com> wrote in message
> >> news:b5nhlu$vti$1@rogue.oti.com...
> >>
> >>> You can make use of the build logger that is provided with Eclipse.
> >>>
> >
> >
> " org.eclipse.ui.externaltools.internal.ant.logger.AntProcessB uildLogger ".
> >
> >> Of
> >>
> >>> course as it is an internal class it comes with no guarantees
> >>> To fully mimic the how Eclipse does its Ant support take a look at the
> >>>
> >>
> >
> org.eclipse.ui.externaltools.internal.ant.launchConfiguratio ns.AntLaunchDele
>
> >
> >>> gate class
> >>>
> >>> HTH
> >>> Darins
> >>>
> >>> "Anders Nilsson" <anders.nilsson@ibs.no> wrote in message
> >>> news:b5mkq8$92i$1@rogue.oti.com...
> >>>
> >>>> Hello,
> >>>>
> >>>> Using 2.1 RC2, I have written a plug-in that uses AntRunner to run an
> >>
> >>
> >> Ant
> >>
> >>>> script. In the plug in development environment, I can get the output
> >>
> >>
> >> from
> >>
> >>>> ant to display in the console of the development workbench by using:
> >>>>
> >>>> runner.addBuildLogger("org.apache.tools.ant.DefaultLogger");
> >>>>
> >>>> I would like to get the output displayed to the Console (or somewhere
> >>
> >>
> >> else
> >>
> >>>> convenient) of the runtime workbench (actually to have users of the
> >>>
> >>>
> >>> plug-in
> >>>
> >>>> see the output). How can this be achieved ? Do I have to write a
> >
> >
> > custom
> >
> >>>> logger ?
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Anders
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
>
|
|
|
Powered by
FUDForum. Page generated in 0.04093 seconds