Thursday, April 23, 2009

Ant - Class doesn't support the "else" attribute.

This post is all about this error and on how to resolve this error.

Just to give some background:
Apache Ant is a Java-based build tool. For more information on Apache Ant, you can visit Apache Ant. The recent version is Apache Ant is Ant 1.71 and can be downloaded from here.
We can add a else attribute in the conditionTask for making a choice.

Coming back to the error that you have encountered:
Class doesn't support the "else" attribute.

This can happen if you have Apache ant with a version less than 1.65
So, Make sure to update your ant to a version more than 1.65. Recent version, as I mentioned is, 1.71.

Does this fix the problem that you encountered with ant?
If yes, Great.

No, then continue reading. We have other fix available for Class doesn't support the "else" attribute.

If you get this error even though you have the ant 1.65 or more, then the following information may be helpful.
-> Check whether the file is marked executable.
You can check the permissions of the file using "ls -l /ant"
->when you don't have execute permissions, mark the file as executable for you/your group.
->Then continue to run. It should run now.

you can mark the file as executable by executing the command,
"chmod 777 \ant" - "rwxrwxrwx" - universal writable.
"chmod 775 \ant" - "rwxrwxr-x" - only owner and the group can write.

1 comment:

  1. I tried both the solutions: 1. Ant version is 1.7.1 and 2. Executable
    But i am still getting the same error