/usr/share/doc/gradle/userguide/ant.html is in gradle-doc 2.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 19. Using Ant from Gradle</title><link xmlns:xslthl="http://xslthl.sf.net" type="text/css" rel="stylesheet" href="base.css"><link xmlns:xslthl="http://xslthl.sf.net" type="text/css" rel="stylesheet" href="docs.css"><link xmlns:xslthl="http://xslthl.sf.net" type="text/css" rel="stylesheet" href="userguide.css"><meta content="DocBook XSL Stylesheets V1.79.1" name="generator"><link rel="home" href="userguide.html" title="Gradle User Guide"><link rel="up" href="pt03.html" title="Part III. Writing Gradle build scripts"><link rel="prev" href="working_with_files.html" title="Chapter 18. Working With Files"><link rel="next" href="build_lifecycle.html" title="Chapter 20. The Build Lifecycle"></head><body><div class="navheader"><div><div class="navbar"><a xmlns:xslthl="http://xslthl.sf.net" href="working_with_files.html" title="Chapter 18. Working With Files">Previous</a><span>|</span><a xmlns:xslthl="http://xslthl.sf.net" href="userguide.html" title="Gradle User Guide">Contents</a><span>|</span><a xmlns:xslthl="http://xslthl.sf.net" href="build_lifecycle.html" title="Chapter 20. The Build Lifecycle">Next</a></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 xmlns:xslthl="http://xslthl.sf.net"><a name="ant"></a>Chapter 19. Using Ant from Gradle</h1></div></div></div><p>Gradle provides excellent integration with Ant. You can use individual Ant tasks or entire Ant builds in your
Gradle builds. In fact, you will find that it's far easier and more powerful using Ant tasks in a Gradle build
script, than it is to use Ant's XML format. You could even use Gradle simply as a powerful Ant task scripting
tool.
</p><p>Ant can be divided into two layers. The first layer is the Ant language. It provides the syntax for the
<code class="filename">build.xml</code> file, the handling of the targets, special constructs like macrodefs, and so on.
In other words, everything except the Ant tasks and types. Gradle understands this language, and allows you to
import your Ant <code class="filename">build.xml</code> directly into a Gradle project. You can then use the targets of
your Ant build as if they were Gradle tasks.
</p><p>The second layer of Ant is its wealth of Ant tasks and types, like <code class="literal">javac</code>,
<code class="literal">copy</code> or <code class="literal">jar</code>. For this layer Gradle provides integration
simply by relying on Groovy, and the fantastic <code class="literal">AntBuilder</code>.
</p><p>Finally, since build scripts are Groovy scripts, you can always execute an Ant build as an external process.
Your build script may contain statements like:<code class="literal">"ant clean compile".execute()</code>.
<a href="#ftn.N1177B" class="footnote" name="N1177B"><sup class="footnote">[8]</sup></a>
</p><p>You can use Gradle's Ant integration as a path for migrating your build from Ant to Gradle. For example, you
could start by importing your existing Ant build. Then you could move your dependency declarations from the Ant
script to your build file. Finally, you could move your tasks across to your build file, or replace them with
some of Gradle's plugins. This process can be done in parts over time, and you can have a working Gradle build
during the entire process.
</p><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="N11781"></a>19.1. Using Ant tasks and types in your build</h2></div></div></div><p>In your build script, a property called <code class="literal">ant</code> is provided by Gradle. This is a reference
to an <a class="ulink" href="../javadoc/org/gradle/api/AntBuilder.html" target="_top"><code class="classname">AntBuilder</code></a> instance. This <code class="literal">AntBuilder</code> is used to
access Ant tasks, types and properties from your build script. There is a very simple mapping from Ant's
<code class="filename">build.xml</code> format to Groovy, which is explained below.
</p><p>You execute an Ant task by calling a method on the <code class="literal">AntBuilder</code> instance. You use the task
name as the method name. For example, you execute the Ant <code class="literal">echo</code> task by calling the
<code class="literal">ant.echo()</code> method. The attributes of the Ant task are passed as Map parameters to the
method. Below is an example of the <code class="literal">echo</code> task. Notice that we can also mix
Groovy code and the Ant task markup. This can be extremely powerful.</p><div class="example"><a name="useAntTask"></a><p class="title"><b>Example 19.1. Using an Ant task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task hello << {
String greeting = <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'hello from Ant'</span>
ant.echo(message: greeting)
}
</pre><p>Output of <strong class="userinput"><code>gradle hello</code></strong></p><pre class="screen">> gradle hello
:hello
[ant:echo] hello from Ant
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>
You pass nested text to an Ant task by passing it as a parameter of the task method call. In this example, we
pass the message for the <code class="literal">echo</code> task as nested text:
</p><div class="example"><a name="taskWithNestedText"></a><p class="title"><b>Example 19.2. Passing nested text to an Ant task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task hello << {
ant.echo(<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'hello from Ant'</span>)
}
</pre><p>Output of <strong class="userinput"><code>gradle hello</code></strong></p><pre class="screen">> gradle hello
:hello
[ant:echo] hello from Ant
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>You pass nested elements to an Ant task inside a closure. Nested elements are defined in the same way
as tasks, by calling a method with the same name as the element we want to define.</p><div class="example"><a name="taskWithNestedElements"></a><p class="title"><b>Example 19.3. Passing nested elements to an Ant task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task zip << {
ant.zip(destfile: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'archive.zip'</span>) {
fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'src'</span>) {
include(name: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'**.xml'</span>)
exclude(name: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'**.java'</span>)
}
}
}
</pre></div></div><br class="example-break"><p>You can access Ant types in the same way that you access tasks, using the name of the type as the
method name. The method call returns the Ant data type, which you can then use directly in your build script. In the
following example, we create an Ant <code class="literal">path</code> object, then iterate over the contents of it.</p><div class="example"><a name="useAntType"></a><p class="title"><b>Example 19.4. Using an Ant type</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task list << {
def path = ant.path {
fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>, includes: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'*.jar'</span>)
}
path.list().each {
println it
}
}
</pre></div></div><br class="example-break"><p>More information about <code class="literal">AntBuilder</code> can be found in 'Groovy in Action' 8.4 or at the
<a class="ulink" href="http://groovy.codehaus.org/Using+Ant+from+Groovy" target="_top">Groovy Wiki</a>
</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="N117EB"></a>19.1.1. Using custom Ant tasks in your build</h3></div></div></div><p>To make custom tasks available in your build,
you can use the <code class="literal">taskdef</code> (usually easier) or <code class="literal">typedef</code> Ant task,
just as you would in a <code class="literal">build.xml</code> file. You can then refer to the custom Ant task as you
would a built-in Ant task.
</p><div class="example"><a name="useExternalAntTask"></a><p class="title"><b>Example 19.5. Using a custom Ant task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task check << {
ant.taskdef(resource: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'checkstyletask.properties'</span>) {
classpath {
fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>, includes: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'*.jar'</span>)
}
}
ant.checkstyle(config: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'checkstyle.xml'</span>) {
fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'src'</span>)
}
}
</pre></div></div><br class="example-break"><p>
You can use Gradle's dependency management to assemble the classpath to use for the custom tasks.
To do this, you need to define a custom configuration for the classpath, then add some dependencies
to the configuration. This is described in more detail in <a class="xref" href="dependency_management.html#sec:how_to_declare_your_dependencies">Section 23.4, “How to declare your dependencies”</a>.
</p><div class="example"><a name="useExternalAntTaskWithConfig"></a><p class="title"><b>Example 19.6. Declaring the classpath for a custom Ant task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">configurations {
pmd
}
dependencies {
pmd group: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd'</span>, name: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd'</span>, version: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'4.2.5'</span>
}
</pre></div></div><br class="example-break"><p>To use the classpath configuration, use the <code class="literal">asPath</code> property of the custom configuration.</p><div class="example"><a name="useExternalAntTaskWithConfig"></a><p class="title"><b>Example 19.7. Using a custom Ant task and dependency management together</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">task check << {
ant.taskdef(name: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd'</span>,
classname: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'net.sourceforge.pmd.ant.PMDTask'</span>,
classpath: configurations.pmd.asPath)
ant.pmd(shortFilenames: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'true'</span>,
failonruleviolation: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'true'</span>,
rulesetfiles: file(<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd-rules.xml'</span>).toURI().toString()) {
formatter(type: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'text'</span>, toConsole: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'true'</span>)
fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'src'</span>)
}
}
</pre></div></div><br class="example-break"></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="N11821"></a>19.2. Importing an Ant build</h2></div></div></div><p>You can use the <code class="literal">ant.importBuild()</code> method to import an Ant build into your Gradle
project. When you import an Ant build, each Ant target is treated as a Gradle task. This means you can
manipulate and execute the Ant targets in exactly the same way as Gradle tasks.
</p><div class="example"><a name="antHello"></a><p class="title"><b>Example 19.8. Importing an Ant build</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.importBuild <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>
</pre><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><project></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><target</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"hello"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><echo></span>Hello, from Ant<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></echo></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></target></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></project></span>
</pre><p>Output of <strong class="userinput"><code>gradle hello</code></strong></p><pre class="screen">> gradle hello
:hello
[ant:echo] Hello, from Ant
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>You can add a task which depends on an Ant target:
</p><div class="example"><a name="dependsOnAntTarget"></a><p class="title"><b>Example 19.9. Task that depends on Ant target</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.importBuild <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>
task intro(dependsOn: hello) << {
println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}
</pre><p>Output of <strong class="userinput"><code>gradle intro</code></strong></p><pre class="screen">> gradle intro
:hello
[ant:echo] Hello, from Ant
:intro
Hello, from Gradle
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>Or, you can add behaviour to an Ant target:</p><div class="example"><a name="addBehaviourToAntTarget"></a><p class="title"><b>Example 19.10. Adding behaviour to an Ant target</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.importBuild <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>
hello << {
println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}
</pre><p>Output of <strong class="userinput"><code>gradle hello</code></strong></p><pre class="screen">> gradle hello
:hello
[ant:echo] Hello, from Ant
Hello, from Gradle
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>It is also possible for an Ant target to depend on a Gradle task:</p><div class="example"><a name="dependsOnTask"></a><p class="title"><b>Example 19.11. Ant target that depends on Gradle task</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.importBuild <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>
task intro << {
println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}
</pre><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><project></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><target</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"hello"</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">depends</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"intro"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><echo></span>Hello, from Ant<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></echo></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></target></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></project></span>
</pre><p>Output of <strong class="userinput"><code>gradle hello</code></strong></p><pre class="screen">> gradle hello
:intro
Hello, from Gradle
:hello
[ant:echo] Hello, from Ant
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>
Sometimes it may be necessary to “rename” the task generated for an Ant target to avoid a naming collision with existing Gradle tasks.
To do this, use the <a class="ulink" href="../javadoc/org/gradle/api/AntBuilder.html#importBuild(java.lang.Object, org.gradle.api.Transformer)" target="_top"><code class="classname">AntBuilder.importBuild()</code></a> method.
</p><div class="example"><a name="renameAntDelegate"></a><p class="title"><b>Example 19.12. Renaming imported Ant targets</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.importBuild(<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>) { antTargetName ->
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'a-'</span> + antTargetName
}
</pre><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><project></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><target</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"hello"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><echo></span>Hello, from Ant<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></echo></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></target></span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></project></span>
</pre><p>Output of <strong class="userinput"><code>gradle a-hello</code></strong></p><pre class="screen">> gradle a-hello
:a-hello
[ant:echo] Hello, from Ant
BUILD SUCCESSFUL
Total time: 1 secs
</pre></div></div><br class="example-break"><p>
Note that while the second argument to this method should be a <a class="ulink" href="../javadoc/org/gradle/api/Transformer.html" target="_top"><code class="classname">Transformer</code></a>, when programming in Groovy we can simply
use a closure instead of an anonymous inner class (or similar) due to <a class="ulink" href="http://mrhaki.blogspot.ie/2013/11/groovy-goodness-implicit-closure.html" target="_top">Groovy's support for automatically coercing closures to single-abstract-method types</a>.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="N118A3"></a>19.3. Ant properties and references</h2></div></div></div><p>There are several ways to set an Ant property, so that the property can be used by Ant tasks. You can
set the property directly on the <code class="literal">AntBuilder</code> instance. The Ant properties are also
available as a Map which you can change. You can also use the Ant <code class="literal">property</code> task.
Below are some examples of how to do this.
</p><div class="example"><a name="antProperties"></a><p class="title"><b>Example 19.13. Setting an Ant property</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.buildDir = buildDir
ant.properties.buildDir = buildDir
ant.properties[<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'buildDir'</span>] = buildDir
ant.property(name: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'buildDir'</span>, location: buildDir)
</pre><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><echo></span>buildDir = ${buildDir}<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"></echo></span>
</pre></div></div><br class="example-break"><p>Many Ant tasks set properties when they execute. There are several ways to get the value of these properties.
You can get the property directly from the <code class="literal">AntBuilder</code> instance. The Ant properties are
also available as a Map. Below are some examples.</p><div class="example"><a name="antProperties"></a><p class="title"><b>Example 19.14. Getting an Ant property</b></p><div class="example-contents"><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><property</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"antProp"</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">value</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"a property defined in an Ant build"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/></span>
</pre><p><code class="filename">build.gradle</code></p><pre class="programlisting">println ant.antProp
println ant.properties.antProp
println ant.properties[<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'antProp'</span>]
</pre></div></div><br class="example-break"><p>There are several ways to set an Ant reference:</p><div class="example"><a name="antProperties"></a><p class="title"><b>Example 19.15. Setting an Ant reference</b></p><div class="example-contents"><p><code class="filename">build.gradle</code></p><pre class="programlisting">ant.path(id: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'classpath'</span>, location: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)
ant.references.classpath = ant.path(location: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)
ant.references[<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'classpath'</span>] = ant.path(location: <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)
</pre><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><path</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">refid</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"classpath"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/></span>
</pre></div></div><br class="example-break"><p>There are several ways to get an Ant reference:</p><div class="example"><a name="antProperties"></a><p class="title"><b>Example 19.16. Getting an Ant reference</b></p><div class="example-contents"><p><code class="filename">build.xml</code></p><pre class="programlisting"><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag"><path</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">id</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"antPath"</span> <span xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">location</span>=<span xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"libs"</span><span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/></span>
</pre><p><code class="filename">build.gradle</code></p><pre class="programlisting">println ant.references.antPath
println ant.references[<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'antPath'</span>]
</pre></div></div><br class="example-break"></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a name="N118F7"></a>19.4. API</h2></div></div></div><p>The Ant integration is provided by <a class="ulink" href="../javadoc/org/gradle/api/AntBuilder.html" target="_top"><code class="classname">AntBuilder</code></a>.</p></div><div class="footnotes"><br><hr width="100" align="left"><div id="ftn.N1177B" class="footnote"><p><a href="#N1177B" class="para"><sup class="para">[8] </sup></a>In Groovy you can execute Strings. To learn more about executing external processes with Groovy have a
look in 'Groovy in Action' 9.3.2 or at the Groovy wiki
</p></div></div></div><div class="navfooter"><div><div class="navbar"><a xmlns:xslthl="http://xslthl.sf.net" href="working_with_files.html" title="Chapter 18. Working With Files">Previous</a><span>|</span><a xmlns:xslthl="http://xslthl.sf.net" href="userguide.html" title="Gradle User Guide">Contents</a><span>|</span><a xmlns:xslthl="http://xslthl.sf.net" href="build_lifecycle.html" title="Chapter 20. The Build Lifecycle">Next</a></div></div></div></body></html>
|