...
Assuming groovy-all-VERSION.jar is in my.classpath you will need to declare this task at some point in the build.xml prior to the groovyc task being invoked.
| Code Block |
|---|
<taskdef name="groovyc"
classname="org.codehaus.groovy.ant.Groovyc"
classpathref="my.classpath"/>
|
...
Attribute | Description | Required |
|---|---|---|
srcdir | Location of the Groovy (and possibly Java) source files. | Yes |
destdir | Location to store the class files. | Yes |
classpath | The classpath to use. | No |
classpathref | The classpath to use given as a path references. | No |
sourcepath | The sourcepath to use. | No |
sourcepathref | The sourcepath to use given as a path reference. | No |
encoding | Encoding of source files. | No |
verbose | Asks the compiler for verbose output; defaults to no. | No |
includeAntRuntime | Whether to include the Ant run-time libraries in the classpath; defaults to yes. | No |
includeJavaRuntime | Whether to include the default run-time libraries from the executing VM in the classpath; defaults to no. | No |
fork | Whether to execute groovyc using a spawned instance of the JVM; defaults to no. | No |
memoryInitialSize | The initial size of the memory for the underlying VM, if using fork mode; ignored otherwise. Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m) | No |
memoryMaximumSize | The maximum size of the memory for the underlying VM, if using fork mode; ignored otherwise. Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m) | No |
failonerror | Indicates whether compilation errors will fail the build; defaults to true. | No |
listfiles | Indicates whether the source files to be compiled will be listed; defaults to no. | No |
stacktrace | if true each compile error message will contain a stacktrace | No |
jointCompilationOptions* | Enable joint compilation, specifying the command line options. (Using a nested javac task is preferred.) | No |
| indy | Enable compilation with the "invoke dynamic" support when using Groovy 2.0 and beyond and running on JDK 7 | No |
Notes: Joint compilation is only available since 1.1-beta-2, jointCompilationOptions is no longer supported, use the nested javac instead
...
The right way of working is, of course, to use a nested tag and all the attributes and further nested tags as required. It is rare to specify srcdir and destdir, the nested javac task is provided with the srcdir and destdir values from the enclosing groovyc task, and it is invariable the right thing to do just to leave this as is. Here is an example:
| Code Block | ||
|---|---|---|
| ||
<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>
|
...