Apache Groovy Ant Task integration library providing seamless integration between Groovy scripting capabilities and Apache Ant build automation framework
npx @tessl/cli install tessl/maven-org-codehaus-groovy--groovy-ant@2.5.0Apache Groovy Ant Tasks provides comprehensive integration between Groovy programming language and Apache Ant build automation framework. This library enables execution of Groovy scripts within Ant build files, compilation of Groovy source code, generation of documentation, and programmatic access to Ant functionality from Groovy code.
pom.xml or Gradle build.gradleMaven:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-ant</artifactId>
<version>2.5.23</version>
</dependency>Gradle:
implementation 'org.codehaus.groovy:groovy-ant:2.5.23'For Ant build files (XML configuration):
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy">
<classpath>
<pathelement location="groovy-ant-2.5.23.jar"/>
</classpath>
</taskdef>
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"/>
<taskdef name="groovydoc" classname="org.codehaus.groovy.ant.Groovydoc"/>For programmatic use in Java/Groovy:
import org.codehaus.groovy.ant.Groovy;
import org.codehaus.groovy.ant.Groovyc;
import org.codehaus.groovy.ant.Groovydoc;
import groovy.util.AntBuilder;
import groovy.util.FileNameFinder;<groovy>
println "Hello from Groovy in Ant!"
project.properties.each { key, value ->
println "$key = $value"
}
</groovy><groovyc srcdir="src/main/groovy" destdir="build/classes"
includeantruntime="false" fork="true">
<classpath>
<fileset dir="lib" includes="*.jar"/>
</classpath>
</groovyc>import groovy.util.AntBuilder
def ant = new AntBuilder()
ant.copy(todir: 'backup') {
fileset(dir: 'src', includes: '**/*.groovy')
}The Groovy Ant integration is built around several key components:
Groovy, Groovyc, Groovydoc) that extend Ant's task frameworkAntBuilder providing Groovy's builder-style access to all Ant tasksExecute Groovy scripts and code snippets directly within Ant build files with full access to Ant project properties and tasks.
public class Groovy extends org.apache.tools.ant.taskdefs.Java {
public void setSrc(File srcFile);
public void addText(String txt);
public void setFork(boolean fork);
public void setClasspath(Path classpath);
public void execute() throws BuildException;
}Comprehensive Groovy and Java source compilation with support for joint compilation, stub generation, and extensive configuration options.
public class Groovyc extends org.apache.tools.ant.taskdefs.MatchingTask {
public void setSrcdir(Path srcDir);
public void setDestdir(File destDir);
public void setClasspath(Path classpath);
public void setFork(boolean fork);
public void execute() throws BuildException;
}Generate comprehensive API documentation from Groovy and Java source files with customizable templates and output formats.
public class Groovydoc extends org.apache.tools.ant.Task {
public void setSourcepath(Path src);
public void setDestdir(File dir);
public void setPackagenames(String packages);
public void setAccess(String access);
public void execute() throws BuildException;
}Groovy builder-style interface for executing Ant tasks programmatically with full type safety and fluent API.
public class AntBuilder extends groovy.util.BuilderSupport {
public AntBuilder();
public AntBuilder(Project project);
public Project getProject();
public void setSaveStreams(boolean saveStreams);
}Ant-style file pattern matching and discovery utilities for build automation and file processing tasks.
public class FileNameFinder implements IFileNameFinder {
public List<String> getFileNames(String basedir, String pattern);
public List<String> getFileNames(String basedir, String pattern, String excludesPattern);
public List<String> getFileNames(Map args);
}// Ant Configuration Types
public interface Path {
public String[] list();
public Path createPath();
public void setRefid(Reference ref);
}
public interface FileSet {
public void setDir(File dir);
public void setIncludes(String includes);
public void setExcludes(String excludes);
}
// Build Exception Types
public class BuildException extends RuntimeException {
public BuildException(String message);
public BuildException(String message, Throwable cause);
public Location getLocation();
}
// Project Types
public class Project {
public void setProperty(String name, String value);
public String getProperty(String name);
public void log(String message);
public File getBaseDir();
}