title: Ant foreach: Cause: The name is undefined. But everything seems to be ok
body: <p>I've got a strange problem with ant. It's version is 1.7.1.</p>
  
  <p>I'm trying to do next thing and get the error.</p>
  
  <pre><code>&lt;target name="execute-all-buildfiles"&gt;
      &lt;foreach param="buildfile-path" target="execute-buildfile"&gt;
          &lt;path&gt;
              &lt;dirset dir="${path.to.server}/share/source"/&gt;
          &lt;/path&gt;
      &lt;/foreach&gt;
  &lt;/target&gt;
  
  &lt;target name="execute-buildfile"&gt;
      &lt;echo message="" /&gt;
      &lt;echo message="" /&gt;
      &lt;echo message="" /&gt;
      &lt;echo message="__________ Building cartridge ${buildfile-path} ___________" /&gt;
      &lt;echo message="" /&gt;
      &lt;echo message="" /&gt;
      &lt;echo message="" /&gt;
      &lt;java
              jvm="${path.to.server}/engine/jdk/bin/java"
              classname="org.apache.tools.ant.launch.Launcher"
              fork="true"
              failonerror="true"&gt;
          &lt;classpath&gt;
              &lt;pathelement location="${ant.home}/lib/ant-launcher.jar"/&gt;
          &lt;/classpath&gt;
          &lt;arg value="-f" /&gt;
          &lt;arg value="${buildfile-path}/build/build.xml" /&gt;
          &lt;arg value="-Dis.home=${path.to.server}" /&gt;
      &lt;/java&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>I've tried less complicated version of foreach, but it doesn't work as well. Please, help me.</p>
  
  <pre><code>&lt;target name="run"&gt;     
     &lt;foreach target="loop" param="loop.param"&gt;  
        &lt;path&gt;
            &lt;dirset dir="${path.to.server}/share/source"/&gt;
        &lt;/path&gt;
     &lt;/foreach&gt;  
  &lt;/target&gt;  
  &lt;target name="loop"&gt;     
     &lt;echo message="${loop.param}"/&gt;  
     &lt;basename property="dir.name" file="${loop.param}"/&gt;  
     &lt;echo message="${dir.name}"/&gt;  
  &lt;/target&gt;  
  </code></pre>
  
  <p>P.S. Sorry for mistakes. Take a look at a simple one.</p>