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 50072 - Depending on freeform project: basedir not correctly evaluated
Summary: Depending on freeform project: basedir not correctly evaluated
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks: 41535
  Show dependency tree
 
Reported: 2004-10-07 09:40 UTC by herkules
Modified: 2006-03-24 10:26 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description herkules 2004-10-07 09:40:52 UTC
The project I have to work on has that obscure
structure:

<project>/batch/build/build.xml
<project>src/com/....

Means the location of build.xml is 'somewhere' and
it defines basedir=../..

I setup a freeform project that works fine. Thus
project.xml correctly contains this line:

<property
name="ant.script">batch/build/build.xml</property>


Now I create a standard NB project and make it
depend on the freeform project. Here is the bug
now: in the new project build-impl.xml, the
following line is inserted:

    <target name="deps-jar" depends="init"
unless="no.deps">
        <ant target="build" inheritall="false"
dir="${project.HerkulesAnt}/batch"
antfile="build/build.xml"/>

This sets a wrong basedir. Should be:

    <target name="deps-jar" depends="init"
unless="no.deps">
        <ant target="build" inheritall="false"
dir="${project.HerkulesAnt}"
antfile="batch/build/build.xml"/>
Comment 1 Jesse Glick 2004-10-07 15:38:48 UTC
I was about to close as WONTFIX, since the current build-impl.xml for
e.g. j2seproject just sets basedir to the dir containing the
subproject's build.xml; specifying just

<ant antfile="sub/build.xml"/>

does not work since then the basedir will be inherited from the
superproject, completely ignoring the basedir decl in sub/build.xml,
yielding nonsense. (Don't ask me why Ant works this way, but it does.)
For that reason we currently do

<ant dir="sub"/> [implied antfile="build.xml"]

which sets basedir to sub, again ignoring any decl in sub/build.xml,
but at least normally correct, since people should avoid basedir
tricks and use basedir="." as a rule.

However I just realized that if you pass inheritall="false" - which we
do anyway - then

<ant antfile="sub/build.xml" inheritall="false"/>

works as expected, picking up any basedir decl from sub/build.xml and
resolving it relative to "sub/".

So what we should do is fix build-impl.xsl in java/j2seproject,
web/project, etc. to delete all the complicated stuff after

  <xsl:variable name="script" select="projdeps:script"/>

and replace it with simply

<ant target="{$subtarget}" inheritall="false">
    <xsl:attribute name="antfile">${project.<xsl:value-of
select="$subproj"/>}/<xsl:value-of select="$script"/></xsl:attribute>
</ant>

which should work in all cases.

Note that this should also simplify the fix of issue #50092 a bit.
Comment 2 David Konecny 2004-10-12 09:52:35 UTC
asotona, you might want to do the same in J2ME.

Fixed in:
java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl;
new revision: 1.37; previous revision: 1.36
web/project/src/org/netbeans/modules/web/project/resources/build-impl.xsl;
new revision: 1.39; previous revision: 1.38
Comment 3 Jesse Glick 2004-10-12 18:43:00 UTC
Also in j2ee, if applicable.
Comment 4 Adam Sotona 2004-10-22 08:46:25 UTC
thanks for notification
fixed in J2ME
Comment 5 Marian Mirilovic 2005-12-20 15:47:10 UTC
This issue was solved long time ago. Because nobody has reopened it neither
added comments, we are verifying/closing it now. 
If you are still able to reproduce the problem, please reopen. Thanks in advance.