There is a bug with the <for> task. It is unable to handle
begin and end being the same.

I cannot push a fix, since I forgot my ant-contrib username/password.

Here is a patch:
Index: src/main/java/net/sf/antcontrib/logic/ForTask.java
===================================================================
--- src/main/java/net/sf/antcontrib/logic/ForTask.java  (revision 177)
+++ src/main/java/net/sf/antcontrib/logic/ForTask.java  (working copy)
@@ -237,7 +237,7 @@
                 throw new BuildException("step cannot be 0");
             } else if (iEnd > begin && step < 0) {
                 throw new BuildException("end > begin, step needs to be > 0");
-            } else if (iEnd <= begin && step > 0) {
+            } else if (iEnd < begin && step > 0) {
                 throw new BuildException("end <= begin, step needs to be < 0");
             }
         }

Peter

On Wed, May 12, 2010 at 6:40 PM, Wray, Nathan <nathan.w...@compuware.com> wrote:
> End needs to be strictly greater than begin.  Change end to 2 and you
> should be ok.
>
>
> The contents of this e-mail are intended for the named addressee only. It 
> contains information that may be confidential. Unless you are the named 
> addressee or an authorized designee, you may not copy or use it, or disclose 
> it to anyone else. If you received it in error please notify us immediately 
> and then destroy it.
>
> From: Jan [mailto:raghure...@gmail.com]
> Sent: Wednesday, May 12, 2010 12:24 PM
> To: Ant Users List
> Subject: Re: Looping number of times
>
> Hi All,
>
> i started using ant-contrib-1.0b3.jar and stuck with one more problem on
> for
> loop
>
> For example see the "end" & "begin" attribute below, i don't want my
> loop to
> start with "0" i want to start with 1
>
> <project xmlns:ac="antlib:net.sf.antcontrib">
>  <taskdef uri="antlib:net.sf.antcontrib"
> resource="net/sf/antcontrib/antlib.xml"
> classpath="C:\my-ant-extension-libs\ant-contrib-1.0b3.jar"
> />
>
>  <echo>${ant.version}</echo>
>  <ac:for param="i" end="1" begin="1">
>   <sequential>
>     <echo>i is @{i}</echo>
>   </sequential>
>  </ac:for>
> </project>
>
> When i run this i get error
> BUILD FAILED
> C:\Temp\test.xml:8: end <= begin, step needs to be < 0
>
> any one has any idea how to make this work? Please help
>
> Thanks  in advance for your help
>
>
> On Thu, Apr 15, 2010 at 11:00 AM, Jan <raghure...@gmail.com> wrote:
>
>> Already tried it and didn't work
>>
>> $ ant -f test.xml
>> Buildfile: test.xml
>> Trying to override old definition of task for
>>      [echo] Apache Ant version 1.6.3 compiled on April 28 2005
>>
>> BUILD FAILED
>> C:\Temp\test.xml:8: The <antlib:net.sf.antcontrib:for> type doesn't
> support
>> the "end" attribute.
>>
>>
>> On Wed, Apr 14, 2010 at 11:52 PM, <jan.mate...@rzf.fin-nrw.de> wrote:
>>
>>> > It did work with antconrib 1.0b3
>>> >
>>> > I just have another question, is there a way to override jar
>>> > in ant lib
>>> > directory
>>>
>>> Try
>>>
>>> <project xmlns:ac="antlib:net.sf.antcontrib">
>>>   <taskdef resource="net/sf/antcontrib/antlib.xml">
>>>    <classpath>
>>>      <pathelement location="-path-to-your-ac-jar"/>
>>>    </classpath>
>>>  </taskdef>
>>> </project>
>>>
>>>
>>> Jan
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
>>> For additional commands, e-mail: user-h...@ant.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to