my dog learned polymorphism*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant error in for loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant error in for loop" Watch "Ant error in for loop" New topic
Author

Ant error in for loop

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1456
    
    5

Hi All,

Firstly, I'm not at all familiar with ant - so, please pardon my ignorance.

We have an ant script to build the component, which used to work fine with Ant 1.7.x and JDK 6.

However, recently, an upgrade was made in which Ant became Ant 1.8.2 and JDK became JDK 7. And after that, the script started to fail.

It is something like this:


As mentioned, initially, it was working properly, but now, it fails with error:
for doesn't support the "begin" attribute


Also, in our script there is an 'if' condition much before this loop. If ant-contrib is not used, then script fails at that if condition itself. However, since script is proceeding this far, it seems that ant-contrib is being used.

So, any idea about this error? That is - how to overcome it, or is there any other way for simple for loop? The value 'count' is read from environment, and we need to perform some operation for 'count' number of times.

Many thanks.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Not an Ant expert, but some pointers-
1. Try debugging the ant execution and see which class/lib ant were using.
2. What's the Ant 1.8.2 docs says for 'for' loop, I'm sure there must be some looping elements in ant.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

If you are really using antcontrib, I don't see how this ever worked because as you can see from the docs:
http://ant-contrib.sourceforge.net/tasks/tasks/for.html
the <for> task doesn't have begin or end properties.

Perhaps someone wrote a <for> task that takes the parameters you posted. You might have to find the person who wrote the build.xml and ask them about it (unless they left instructions..).

And there was never a <for> task in Ant itself.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant error in for loop
 
Similar Threads
Custom ANT Task not working in <for> loop
If-statement with Ant
Internet Explorer Problem
Creating for loops in ANT
Scissors-rock-paper game looking for better way to write the program