Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » AntRunner and Console output
AntRunner and Console output [message #11008] Thu, 01 May 2003 12:54 Go to next message
Eclipse UserFriend
----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 #11068 is a reply to message #11008] Thu, 01 May 2003 15:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jared-eclipse.mn.rr.com

Cross-posting is rude. Don't do it.

- Jared

Doug Spelce wrote:

> ----copied from eclipse.tools newsgroup-----
Re: AntRunner and Console output [message #11274 is a reply to message #11068] Thu, 01 May 2003 16:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jared-eclipse.mn.rr.com

You also cross-posted to the eclipse.platform newsgroup. :)

Doug Spelce wrote:

> Jared,
>
> Sorry, but I mistakenly posted this originally to eclipse.tools, a
> deprecated newsgroup, so I felt it was my "duty" to move it. Maybe I
> should have said "--moved from deprecated newsgroup eclipse.tools--"
> instead, just to eliminate any confusion. :-)
>
> Doug
>
> Jared Burns wrote:
>> Cross-posting is rude. Don't do it.
>>
>> - Jared
>>
>> Doug Spelce wrote:
>>
>>
>>>----copied from eclipse.tools newsgroup-----
Re: AntRunner and Console output [message #11311 is a reply to message #11274] Thu, 01 May 2003 16:33 Go to previous messageGo to next message
Eclipse UserFriend
That post has been cancelled...

Thanks,
Doug

Jared Burns wrote:
> You also cross-posted to the eclipse.platform newsgroup. :)
>
> Doug Spelce wrote:
>
>
>>Jared,
>>
>>Sorry, but I mistakenly posted this originally to eclipse.tools, a
>>deprecated newsgroup, so I felt it was my "duty" to move it. Maybe I
>>should have said "--moved from deprecated newsgroup eclipse.tools--"
>>instead, just to eliminate any confusion. :-)
>>
>>Doug
>>
>>Jared Burns wrote:
>>
>>>Cross-posting is rude. Don't do it.
>>>
>>>- Jared
>>>
>>>Doug Spelce wrote:
>>>
>>>
>>>
>>>>----copied from eclipse.tools newsgroup-----
>
>
Re: AntRunner and Console output [message #12382 is a reply to message #11008] Fri, 02 May 2003 14:23 Go to previous message
Eclipse UserFriend
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
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> >
>
Previous Topic:Ctrl+Space for Code Assistant and Template code generation not working
Next Topic:interaction between multiple windows
Goto Forum:
  


Current Time: Sat May 10 15:46:35 EDT 2025

Powered by FUDForum. Page generated in 0.04093 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top