ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: Could not create task of type: condition.
Date Tue, 14 Nov 2006 10:31:31 GMT
> Hello,
> While compiling using ant, i get the following error:
> Could not create task of type: condition. Common solutions are to use 
> taskdef to declare your task, or, if this is an optional task, to put 
> the optional.jar in the lib directory of your ant installation (ANT_HOME).
> I cant run diagnostics on ant because it seems that option doesn´t 
> exists in this version..., bu running "ant -version" I get this:
> Ant version 1.3 compiled on March 2 2001
> The xml is this:

> What is the problem? the version of ant? If yes, how can I update it.... 
> please explain this knowing I´m a .NET developer and not a java 
> developer... argh :)

wow, that is one old version of Ant. You should switch to Ant1.6.5, at 
the very keast,

There's various ways to get a new version
1. Get a copy bundled into your IDE: eclipse, netbeans and idea all come 
with one.
2. get a copy bundled with websphere, weblogic or whatever. I think this 
is what you have. They are the ones that are usually most messed up.
3. If you have  linux distro, use your package manager and get a copy 
from a repository
4. By hand: go to, download the Zip file and expand it 
somewhere. Set the  ANT_HOME env variable to the directory, and add 
%ANT_HOME%/bin to your path, preferably after finding the old version 
and renaming or removing it.

After upgrading, check with ant -version to make sure the new version is 
being picked upl


 > <target name="set-wscompile" >
 >     <condition property="wscompile" 
 >        <os family="windows"/>
 >     </condition>
 >     <condition property="wscompile" value="${wscompile.dir}/wscompile">
 >        <not>
 >           <os family="windows"/>
 >        </not>
 >     </condition>
 >  </target>

BTW, when you run batch files you dont really want to <exec> the batch 
file. You want to the NT shell, what is it, cmd.exe, with the batch file 
as a parameter

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message