简体   繁体   English

使用ant任务编译Groovy文件

[英]Compile Groovy file with ant task

I don't understand why groovy.compile task runs when I'm trying to run compile task. 我不明白为什么groovy.compile任务在我尝试运行编译任务时运行。

<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? 有没有办法用javac ant任务而不是groovyc ant任务编译.groovy?

No, you need to use the groovyc task, however, you should be able to use the joint compiler by doing: 不,您需要使用groovyc任务,但是,您应该能够通过执行以下操作来使用联合编译器:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM