I found the solution. I needed to add the bin folder to the classpath of the taskdef:
<path id="acceleoClasspath">
<!-- for org.eclipse.acceleo.parser_?.jar etc-->
<fileset dir="libs">
<include name="**/*.jar" />
</fileset>
<pathelement path="bin"/>
</path>
<taskdef id="acceleoCompiler" name="acceleoCompiler"
classname="org.eclipse.acceleo.parser.compiler.AcceleoCompiler"
classpathref="acceleoClasspath" />