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.
[custom build 20040526, JDK 1.4.2] User is not able to create ant build script out of the project on tab Favorites and use it. In fact user is able to create a file build.xml but he cannot do any ant script specific actions on it.
You would need to restart the IDE. Not straightforward to fix currently since the check for the MIME type of the file is done when it is created, at which time it is empty and thus cannot be known to be an Ant script as opposed to any other XML file. There is no API in Filesystems to have the MIME type be recalculated due to changes in file content. Ideally the core MIMEResolver impl would track files for which FileObject.getInputStream was used (due to content-matching patterns) and recheck the MIME type after file modifications. Then there would also need to be some API to refresh MIME type of the file, which Datasystems would have to listen to.
I see this as P2 - in fact not being able to create ant build script and use it. It was esential feature in 3.6. Restarting is not a workaround - we can't require restart to create a build script (it sounds to windows-ish :). One very easy fix would be to allow to create any file outside of project that do not require project context - such files are listed as Supported in UI Spec: [f] XML |- [t] XML Document |- [t] DTD Entity |- [t] XML Schema |- [t] XSL Stylesheet |- [t] OASIS XML Catalog |- [t] XML Parsed Entity -- [t] Cascading Style Sheet [f] Ant Build Scripts |- [t] Blank Ant Project |- [t] Sample Ant Project -- [t] Custom Task [f] Other |- [t] Web Bookmark |- [t] Group of Files |- [t] HTML File |- [t] Properties File -- [t] Text File (Not sure about Group of files). This way nobody will need post-creation MIME resolver and any potentional problems will be resolved because user would create what he really wants (because there might be more file types with extension xml which require own handling, not only ant build scripts).
The trouble is defining exactly what kinds of files require a "project context". Ant Task needs a classpath and so is not appropriate here. Some of the templates listed require special wizard iterators, e.g. XML Document. I suppose there could be a special template category for templates which can be created in any folder. Request comment from Petr and Jano. I am not sure we have time to do this for D however. Perhaps this was an "essential feature" in NB 3.6 but I don't think that is true now. Still consider this P3.
Jano and Petr please could you comment. Thanks.
Priority <= P3 for me.
It might look from developers point of view, but certainly not from users point of view. User is simply not able to create Ant script on disk by IDE that is completly based on Ant. Moreover the IDE looks different after restart - before restart the file is XML - after restart it's Ant build script - what would it be after next restart (user might ask).
can we special case for file named build.xml?
Frankly I don't like these sixth sense solutions that cause even more confusion for users.
Well, but there should be some solution, because when I wanted to create Ant build script out of a project I had to start NB 3.6, which is not what we would like users to do.
I think the only way how to fix this correctly is to do what Milan suggested. OTOH I disagree with saying that "User is simply not able to create Ant script on disk by IDE that is completly based on Ant.". The IDE is *not* based on Ant, the project system that you don't want to use is based on Ant. Btw, what is your build script doing that you don't want to use the project system?
I was creating various Ant scripts for testing purposes.
Workaround: - open favourites tab - find arbitrary ant script (the best is to put one empty ant script into home dir which is present in favourites tab as default) - copy and paste - edit Then you don't need to switch into NB 3.6 and also I hope you could accept that there isn't possible to deliver everything in one release.
We should put this into Release Notes, ... users will surely love it :-)
Milan, could you please elaborate what the build script is doing? What target it has, etc. Or you might attach one.
Hmm, it is not nice but it looks like we'll have to live with that in D. (users will have to use Radek's workaround) We might fix it by some marker on templates in E or F. But in fact we should reather fix the problem with the MIME resolver. Because it is the root cause of the problem. The trouble is that it might be a bit harder than fixing templates.
For some reason it seems that copying a new XML file to which you have added a minimum Ant header does *not* make the copy an Ant script. Odd. Some unwanted hack in Datasystems perhaps?
Another possible workaround: have Ant module recognize all files named "build.xml" regardless of contents. Then if you need a file of a different name, you could make it as "build.xml" and rename it later when you have a valid Ant header.
Another workaround: copy the Ant script template from Templates in the Options dialog and paste into the desired folder, then rename and edit as needed.
I will special-case the name "build.xml" for D. Better than nothing I think.
Now you can create an empty file "build.xml" (must be exactly that name) and all should work normally. committed * Up-To-Date 1.23 ant/src/org/apache/tools/ant/module/loader/AntProjectDataLoader.java committed * Up-To-Date 1.30 ant/src/org/apache/tools/ant/module/xml/AntProjectSupport.java added * Up-To-Date 1.1 ant/test/unit/src/org/apache/tools/ant/module/xml/AntProjectSupportTest.java
Reassigning to new module owner jskrivanek.
Use case seems to be obsolete now.
I think this is still valid. It may be a duplicate of some more general issue that you should be able to create non-project-dependent templates in the Favorites tab. (We need an API for templates to indicate that they can safely be run with no associated project.)
duplicate of issue 51978 *** This issue has been marked as a duplicate of 51978 ***