Yes you can:
The best way is to add an own configuration and its dependency for the task in your ivy.xml
file:
<configuration>
<conf name="generator" visibility="private"/>
</configuration>
<dependencies>
…
<dependency org="com.generator"
name="Generator" rev="2.0-RELEASE"
conf="generator->default"/>
</dependencies>
Then you can use it in your build.xml
:
<ivy:cachepath pathid="generator.classpath"
conf="generator" log="quiet"/>
<taskdef name="generate"
classname="com.Generator"
classpathref="generator.classpath"/>
You need the ivy task defined to do so!