This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 57970 - Better control of Ant execution in AntTargetExecutor.Env
Summary: Better control of Ant execution in AntTargetExecutor.Env
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: All All
: P4 blocker (vote)
Assignee: Tomas Stupka
URL:
Keywords: API
Depends on:
Blocks: 60947
  Show dependency tree
 
Reported: 2005-04-18 05:43 UTC by _ sandipchitale
Modified: 2016-07-07 08:39 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ sandipchitale 2005-04-18 05:43:37 UTC
The org.apache.tools.ant.module.api.AntTargetExecutor allows execution of Ant 
scripts. However it seems to create its *own* output window. This creates 
multiple output windows each time an Ant script/target combination is 
executed. If an OuputStream is passed using the  
org.apache.tools.ant.module.api.AntTargetExecutor.Env object, it throws a Not 
Supported or some such exception.

Provide some way to execute Ant scripts and make the output go to an 
OutputStream (to an output window) controlled by user code. Basically user may 
want to execute multiple Ant scripts as part of a single logical operation and 
make the output go to same output window.

It would be even better if no output window was created implicitly. Then the 
user could use the org.apache.tools.ant.module.spi.AntLogger (registered using 
the META-INF/services) mechanism, capture the output of Ant scripts and show 
the output in wizard, dialog or some other UI.
Comment 1 Jesse Glick 2005-04-18 16:43:33 UTC
For reference, what are the intended use cases for such a feature? Please list
them in detail.
Comment 2 _ sandipchitale 2005-04-18 19:14:45 UTC
Use case:

Ant is integrated into NetBeans. Ant has a lot of built-in tasks like Copy, 
Move, Zip, Unzip and so on. The programmer wants to use these tasks as steps 
in some wizard/dialog based operation. The programmer wants to capture the 
output of such tasks, massage/process/filter it and show it in a text area/ 
editor pane inside the wizard/dialog. The output should *not* go to the output 
window/tab of the IDE main window as the wizard/dialog may be modal and may be 
hidin g the output window.
Comment 3 Jesse Glick 2005-04-18 20:01:45 UTC
Right, but I would like something more detailed - what concretely would you want
to use it for? It is best to know the context for an RFE so that I don't
implement something which in fact is useless to you.
Comment 4 _ sandipchitale 2005-04-18 20:27:25 UTC
Concrete use case:

I am implementing migration of a project. I am supporting an in-place 
migration. To do that I am using the New Project wizard of NetBeans (Import 
Old Project choice implemented using an TemplateWizard.Iterator mechanism). In 
the wizard iterator I collect the location of original project and a folder 
where the original project will be backed up. When the user clicks the Finish 
button I perform the following steps in the instantiate() method of the 
iterator:

1. Invoke an Ant script/target1 to backup the original project.
2. Programatically create a NetBeans Web project.
3. Invoke an Ant script/target2 to copy several artifacts from backed up 
project to the newly created Web project.
4. Programatically post-process the project.

Form the user's perspective this is a single operation. Implementation wise it 
a combination of Ant script invocations and programatic operations. I want to 
seamlessly show the progress of each step in the wizard itself. I do not want 
any output windows opened/created.

I hope this much detail is sufficient.
Comment 5 Jesse Glick 2005-04-18 22:12:25 UTC
OK, should be possible I think. May not be trivial. I can't promise when I'll
get to it - for 4.2 if I have the time.
Comment 6 Jesse Glick 2005-08-30 23:56:10 UTC
Cf. issue #43072.
Comment 7 Jan Lahoda 2005-11-28 19:32:43 UTC
See also issue #60947.
Comment 8 Jesse Glick 2008-05-30 16:39:08 UTC
Still no recorded use case. Sandip's use case does not make much sense to me; you surely do not need to run Ant just to
copy a few files.
Comment 9 _ sandipchitale 2008-05-30 18:39:13 UTC
You can close this. My use case is no longer there.
Comment 10 Jesse Glick 2008-05-30 18:48:38 UTC
I'll leave open in case another use case turns up.
Comment 11 Eduardo.m Costa 2008-06-27 13:08:42 UTC
I agree with Jesse when he says "you surely do not need to run Ant just to copy a few files", but there are special
cases when this can't be changed.

My case consist of a lot of legacy projects that uses "handwritten" Ant scripts to compile, copy, zip, unpack, zip again
(in a jar or war) and copy to target folder. The official IDE here is IBM RAD (unfortunatelly) and, when I use NetBeans,
I must keep these ant scripts intact. I use NB "project with existing sources" feature to develop locally, without
adding NB's scripts to SVN, but, when I want to deploy an application, I must perform a lot of manual tasks that could
be done in a wizard, just like Sandip reported.
Comment 12 Jesse Glick 2008-06-27 19:26:18 UTC
I don't follow the use case here. If you have some existing Ant script with some complicated logic, fine - run it. Why
do you need to capture output into a string? (There is no need to create a module with a wizard just to bind an Ant
target to a menu item or similar; just right-click a target and use Create Shortcut.)
Comment 13 Eduardo.m Costa 2008-06-28 00:25:11 UTC
It is really ugly, but the script prints out some information that must be readden and copied to another file and etc. I
don't know if it was Sandip case, but, IMHO, this is the kind of need that appears when we deal with legacy code that
can't be refactored.
Comment 14 Martin Balin 2016-07-07 08:39:27 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss