https://issues.apache.org/bugzilla/show_bug.cgi?id=45858

           Summary: AntXtras foreach tasks fail with undefined loop
                    variables
           Product: Ant
           Version: 1.8Alpha (nightly)
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Other
        AssignedTo: notifications@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


Using nightly snapshot ant_20080922041906.tar.gz, my builds are failing where
they use the AntXtras (http://antxtras.sourceforge.net) callforeach/foreach
tasks (and possibly others - there's a heirarchy of tasks starting at 'call'
that this could apply to).
I'm using AntXtras 0.5.1 (the latest available build).

What appears to be happening is that the loop variable (defined as i="" in the
task) is not being set.
This same build script works with Ant 1.6.x and 1.7.x.

Example build file that demonstrates this issue is:

<?xml version="1.0"?>
<project name="AntXTest" default="build" basedir="."
xmlns:antx="antlib:com.idaremedia.antx">
        <description>
                Demonstrates breakage of Antx foreach task on Ant SVN snapshot
        </description>

        <property name="build.dir" value="${basedir}"/>

        <!-- AntXtras Tasks from "com/idaremedia/antx/antlib.xml" -->
        <taskdef resource="com/idaremedia/antx/antlib.xml"
uri="antlib:com.idaremedia.antx">
                <classpath>
                        <fileset dir="${build.dir}/antx">
                                <include name="JWare_apis.jar"/>
                                <include name="AntX_tasks.jar"/>
                        </fileset>
                </classpath>
        </taskdef>

        <target name="build">
                <antx:foreach i="loop" list="1,2,3,4"  mode="local" >
                        <echo message="Index is ${loop}"/>
                </antx:foreach>
        </target>

</project>

And a verbose log of the foreach task failing to work:

Apache Ant version 1.8.0alpha compiled on September 22 2008
Buildfile:
/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3/build.xml
Detected Java version: 1.6 in:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Detected OS: Mac OS X
parsing buildfile
/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3/build.xml
with URI =
file:/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3/build.xml
Project base dir set to:
/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3
parsing buildfile
jar:file:/Users/archie/Downloads/ant/dist/lib/ant.jar!/org/apache/tools/ant/antlib.xml
with URI =
jar:file:/Users/archie/Downloads/ant/dist/lib/ant.jar!/org/apache/tools/ant/antlib.xml
parsing buildfile
jar:file:/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3/antx/AntX_tasks.jar!/com/idaremedia/antx/antlib.xml
with URI =
jar:file:/Users/archie/Projects/OrionPlatform/Tools/com.orchestral.common.hibernate3/antx/AntX_tasks.jar!/com/idaremedia/antx/antlib.xml
[antlib:com.idaremedia.antx] Could not load definitions from resource
com/idaremedia/antx/antlib.xml. It could not be found.
[presetdef] defining preset antlib:com.idaremedia.antx:macrolocals
[presetdef] defining preset antlib:com.idaremedia.antx:macroisolate
[presetdef] defining preset antlib:com.idaremedia.antx:looplocals
[presetdef] defining preset antlib:com.idaremedia.antx:loopisolate
[presetdef] defining preset antlib:com.idaremedia.antx:pathproperty
[presetdef] defining preset antlib:com.idaremedia.antx:true
Build sequence for target(s) `build' is [build]
Complete build sequence is [build, ]

build:
 [macrodef] creating macro  foreach622517_macrodef
Property "loop" has not been set
     [echo] Index is ${loop}
Property "loop" has not been set
     [echo] Index is ${loop}
Property "loop" has not been set
     [echo] Index is ${loop}
Property "loop" has not been set
     [echo] Index is ${loop}


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to