Compile Groovy file with ant task

ant, groovy, java, javac

Solution

No, you need to use the `groovyc` task, however, you should be able to use the joint compiler by doing:

<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
    <classpath>
        <path refid="compile.classpath"/>
    </classpath>
</taskdef>

<target name="compile" description="Compile both groovy and java files" depends="init">
    <groovyc srcdir="src" destdir="bin/classes">
        <javac debug="on" deprecation="true"/>
    </groovyc>
</target>

Problem

I don't understand why groovy.compile task runs when I'm trying to run compile task. ``` <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"> <classpath> <path refid="compile.classpath"/> </classpath> </taskdef> <target name="groovy.compile"> <groovyc srcdir="src/groovytest" destdir="bin/classes"/> </target> <target name="compile" description="Compile *.java file" depends="init, groovy.compile"> <javac srcdir="src" destdir="bin/classes" debug="on" deprecation="true"> <classpath refid="compile.classpath"/> </javac> </target> ``` Is there a way to compile .groovy with javac ant task and not groovyc ant task?

Original source