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.
Summary: | Ant build target shortcut loses basedir | ||
---|---|---|---|
Product: | projects | Reporter: | Mike Cepek <mcepek> |
Component: | Ant | Assignee: | Jesse Glick <jglick> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | Keywords: | SIMPLEFIX |
Priority: | P4 | ||
Version: | 3.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Mike Cepek
2003-07-08 20:08:34 UTC
The mini Ant script which is the shortcut - you can see this in the Menu area of the Options dialog, e.g., or in the Customize Generated Code wizard panel - just calls <ant dir="wherever"/> on the selected Ant script. For historical reasons, this sets ${basedir} to "wherever" regardless of the basedir attr on wherever/build.xml's <project> - fine if basedir=".", wrong otherwise as you found. Just using antfile="wherever/build.xml" won't work at all because that will *leave* ${base.dir} as some bogus directory like ~/nbdev/system/Menu/Build, wherever the shortcut script was. Fortunately recent versions of Ant have a workaround (added I think partially at my request, IIRC). You can just write: <ant antfile="wherever/build.xml" inheritall="false"/> and wherever/build.xml's basedir should be used. Lowering priority due to existence of a workaround - just edit your shortcut. Have untested patch. Thanks for the info, Jesse. Unfortunately I cannot get the suggested workaround to work. Adding: inheritAll="false" to the <ant> task in the shortcut script didn't help. Same error. I tried a variation on your idea (which I thought was clever, but apparently not clever enough). Assuming the two build files are in the following locations: abspath/mypath/build.xml abspath/build.xml I added: basedir="abspath" to the <project> tag, and used: dir="mypath" in the <ant> task (both in the shortcut script). That didn't work either (same error), regardless of the inheritAll setting. Seemed like it should have, though, don't you think? So I haven't found a workaround that works for me yet. :-( I did appreciate your "Default Filesystem" setting suggestion. It made it very easy to do the above tests. But I noticed that the "Hidden=False" setting is not remembered across NetBeans restarts. Is that as expected? It surprised me. Re. inheritall="false" not working: OK, I haven't tried it yet in NB; I just confirmed that it works as documented on the command-line. Will look into it. Re. Hidden on Default System not being persistent - I agree; so if you agree (and care) please reopen issue #26289. Working fine for me with the patch. 1. In mount point ~/nbdev/sampledir, create subfolder test34802, with a build.xml: <?xml version="1.0" encoding="UTF-8"?> <project basedir="subdir" default="all"> <target name="all"> <ant antfile="build.xml"/> </target> </project> and a subdir 'subdir' of test34802 with a build.xml: <?xml version="1.0" encoding="UTF-8"?> <project basedir="." default="all"> <target name="all"> <echo>here I am: ${someprop}</echo> </target> </project> Set someprop=someval in Ant Settings -> Properties to make sure these are still passed along. Invoke shortcut wizard, select 'all' target of first build.xml, add a menu item. It creates in my menu: <?xml version="1.0" encoding="UTF-8"?> <project default="run" name="34802"> <target name="run"> <ant antfile="/home/jglick/nbdev/sampledir/test34802/build.xml" inheritall="false" target="all"/> </target> </project> When this menu item is run, it correctly prints: run: all: all: here I am: someval BUILD SUCCESSFUL Total time: 0 seconds So I will commit the patch as I have it. Perhaps you mistyped something in your version of the shortcut, it is not clear. You write: "Adding: inheritAll="false" to the <ant> task in the shortcut script didn't help. Same error." but you must not only add the 'inheritall' attr, you must delete the 'dir' attr (which forcibly sets the basedir in all cases) and instead fully qualify the 'antfile' attr. committed Up-To-Date 1.13 ant/src/org/apache/tools/ant/module/wizards/shortcut/SelectTargetPanel.java closed |