tags:

views:

1013

answers:

3

I have to include Groovy classes into existing Java apps , and include Groovy into Ant build.xml file. What is the best way to configure Ant build.xml for it?

Thanks Tatyana

I was suggested to update my question, but I am not exactly sure what it means. Tatyana

Urs Reupke wrote: Please update your question to help future answers become more helpful. – Urs Reupke

+1  A: 

To use Groovy in your ant script, you basically have to 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>

However, you have to be careful, in your ant.xml, to refer to fileset within your current target.

VonC
+1  A: 

@VonC is correct about including Groovy scripting in your Ant build.

To expand a bit:

To compile .groovy and .java sources together for use in the same application, use the <groovyc> Ant task.

See Ant Integration with Groovy for the reference.

Ken Gentle
A: 

Are there more specifics in combining Java and Groovy compilations? Sequence of tasks?

Tatyana Solovyeva
groovyc will compile groovy and java source (first groovy to java, then compile all java files if you want to look at it that way.) so you don't need another step. Or you can separate the java compilation from the groovy and include the compiled/jar-ed classes in the groovyc task.
Ken Gentle
Please update your question to help future answers become more helpful.
Urs Reupke