Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Groovy file with ant task

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?

like image 925
emilan Avatar asked Dec 17 '22 01:12

emilan


1 Answers

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>
like image 106
tim_yates Avatar answered Dec 27 '22 15:12

tim_yates