Bug 52922 - The <ant> task propagates ant.project.name even if inheritAll is false
Summary: The <ant> task propagates ant.project.name even if inheritAll is false
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.8.3
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-15 19:47 UTC by rich
Modified: 2012-03-15 23:03 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rich 2012-03-15 19:47:27 UTC
The <ant> task doesn't appear to honor the built-in ant.project.name property even if the inheritAll attribute is set.

If I have one build file, build.xml:

<project name="abuild">
    <target name="run">
        <property name="aprop" value="one" />
        <ant antfile="build-other.xml" target="doit" useNativeBasedir="true" inheritAll="false" />
    </target>
</project>

and the build-other.xml is:

<project>
    <target name="doit">
        <echo message="${aprop}" />
        <echo message="${ant.project.name}" />
    </target>
</project>

I get output like this when I execute the build.xml run target:

C:\Development\projects\ant-playground\ant-project-name-via-ant-task>ant run
Buildfile: C:\Development\projects\ant-playground\ant-project-name-via-ant-task\build.xml

run:

doit:
     [echo] ${aprop}
     [echo] abuild

BUILD SUCCESSFUL
Total time: 0 seconds

I would not have expected the ant.project.name property to be set.

Unless, that is, ant.project.name is treated as a "user property" (i.e., one passed on the command line) in which case I understand the behavior.  I'm not sure it's what I want, nor is this documented anywhere I could find.