我必须将Groovy类包含到现有的Java应用程序中,并将Groovy包含到Ant的build.xml
文件中。Ant build.xml中的Groovy(带有Java类)
为它配置Ant的build.xml
最好的方法是什么?
更新:在Java和Groovy编译组合中是否有更多细节?任务序列?
我必须将Groovy类包含到现有的Java应用程序中,并将Groovy包含到Ant的build.xml
文件中。Ant build.xml中的Groovy(带有Java类)
为它配置Ant的build.xml
最好的方法是什么?
更新:在Java和Groovy编译组合中是否有更多细节?任务序列?
要Ant脚本使用Groovy,你基本上要declare the Groovy ant task:
<project name="groovy-build" default="listSourceFiles">
<taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy"/>
<groovy>
ant.... // some ant groovy directives
</groovy>
</target>
</project>
但是,你要小心,你的ant.xml,是指你的current target内文件集。
@VonC在您的Ant构建中包含Groovy脚本是正确的。
要扩展位:
编译.groovy
和.java
来源一起使用在相同的应用,使用<groovyc>
Ant任务。
查看Ant Integration with Groovy仅供参考。
你应该在groovyc里面定义javac,像这样。
<groovyc srcdir="${testSourceDirectory}" destdir="${testClassesDirectory}">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<pathelement path="${testClassesDirectory}"/>
<path refid="testPath"/>
</classpath>
<javac source="1.4" target="1.4" debug="on" />
</groovyc>
欲了解更多信息这里看看:http://groovy.codehaus.org/The+groovyc+Ant+Task在部分联合编制。
诚然,感谢您的注意。 – 2013-08-28 20:36:22