Bug 42715

Summary: ant.version property lost in imported build scripts
Product: Ant Reporter: Russ Baker <rbaker>
Component: Build ProcessAssignee: Ant Notifications List <notifications>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 1.7.0   
Target Milestone: ---   
Hardware: Other   
OS: Windows XP   

Description Russ Baker 2007-06-21 08:04:57 UTC
The ant.version property is unset in imported build scripts using ANT 1.7. I
have a build file that uses an import "<import file="newBuild.xml"/>". In this
file, we do a check to see if the user is using the correct version of ANT using
the following:

    <condition property="ant.version.okay">
        <or>
          <contains string="${ant.version}" substring="1.6"/>
          <contains string="${ant.version}" substring="1.7"/>
        </or>
    </condition>

The property was never set, so I checked to see if the property was set by doing
this:
<echo>
	ANT VERSION: ${ant.version}
</echo> 

And this is exactly what appeared on the output:

ANT VERSION: ${ant.version}

So, it looks like the property gets lost somehow. I tested this on two different
boxes, so I'm pretty sure this is a bug.
Comment 1 Steve Loughran 2007-06-21 08:25:38 UTC

*** This bug has been marked as a duplicate of 42263 ***
Comment 2 Steve Loughran 2007-06-21 08:26:55 UTC
oh, rereading its not quite the same; its import and not subant. Reopening.
Comment 3 Peter Reilly 2007-06-21 09:12:20 UTC
I think that this is the same as  42263.

Please check your build file with a svn build of ant,
or provide an example set of build files that
show the problem.
Comment 4 Russ Baker 2007-06-21 12:38:13 UTC
This is happening when I am testing the Beehive dist. You can get the build
files and do a repro by following the instructions here:
http://wiki.apache.org/beehive/For_Beehive_Developers. Once you set up the
environment to use ANT 1.7, you can repro.
Comment 5 Peter Reilly 2007-06-21 13:09:55 UTC
The build file:
http://svn.apache.org/repos/asf/beehive/trunk/ant/beehive-runtime.xml
contains the <ant inheritAll="false"/> task which will trigger
this the 42263 bug:
    <target name="deploy.beehive.webapp.runtime" description="Deploy the Beehive
webapp runtime given a webapp root as -Dwebapp.dir">
        <ant target="deploy.netui" dir="${beehive.home}/netui/" inheritAll="false">
            <property name="webapp.dir" location="${webapp.dir}"/>
        </ant>
    </target>

    <target name="deploy.controls.webapp.runtime" description="Deploy the
Beehive controls runtime given a webapp root as -Dwebapp.dir">
        <ant target="deploy.controls.runtime" dir="${beehive.home}/controls/"
inheritAll="false">
            <property name="webapp.dir" location="${webapp.dir}"/>
        </ant>
    </target>

The project should work with ant 1.7.1(svn), in the mean-time
you can use the work-around of passing the ant.version to
the nested ant project:
   <ant target=....>
     <property name="ant.version" value="${ant.version}"/>
      ...
    </ant>
Re-Marking as duplicate

*** This bug has been marked as a duplicate of 42263 ***