2012-04-19 10 views
4

コンパイルタスクを実行しようとしているときにgroovy.compileタスクが実行される理由を理解できません。AntタスクでGroovyファイルをコンパイルする

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

Antタスクをgroovycのjavac Antタスクでの.groovyコンパイルしないようにする方法はありますか?

+1

は、私の答えの助けをしましたか? –

+0

はい:ありがとう!!!! – emilan

答えて

12

いいえ、あなたはしかし、あなたが行うことで関節のコンパイラを使用することができるはず、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> 
+0

私が見つけたのは、classpathにgroovy-all-XX.jarを含める必要があることだけでした。埋め込みタスクは、親のからクラスパスsrcdirとdestdirを継承します。 – entomo

関連する問題