File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant error in for loop" Watch "Ant error in for loop" New topic

Ant error in for loop

Anayonkar Shivalkar

Joined: Dec 08, 2010
Posts: 1545

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.

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

Joined: Feb 19, 2008
Posts: 2904

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

Joined: May 14, 2008
Posts: 5852

If you are really using antcontrib, I don't see how this ever worked because as you can see from the docs:
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:
subject: Ant error in for loop
It's not a secret anymore!