# getAnt

abstract fun getAnt(): AntBuilder

Returns the `AntBuilder` for this project. You can use this in your build file to execute ant tasks. See example below.

    task printChecksum {
      doLast {
        ant {
          //using ant checksum task to store the file checksum in the checksumOut ant property
          checksum(property: 'checksumOut', file: 'someFile.txt')

          //we can refer to the ant property created by checksum task:
          println "The checksum is: " + checksumOut
        }

        //we can refer to the ant property later as well:
        println "I just love to print checksums: " + ant.checksumOut
      }
    }

Content copied to clipboard
Consider following example of ant target:

    <target name='printChecksum'>
      <checksum property='checksumOut'>
        <fileset dir='.'>
          <include name='agile.txt'/>
        </fileset>
      </checksum>
      <echo>The checksum is: ${checksumOut}</echo>
    </target>

Content copied to clipboard
Here's how it would look like in gradle. Observe how the ant XML is represented in groovy by the ant builder

    task printChecksum {
      doLast {
        ant {
          checksum(property: 'checksumOut') {
            fileset(dir: '.') {
              include name: 'agile1.txt'
            }
          }
        }
        logger.lifecycle("The checksum is $ant.checksumOut")
      }
    }

Content copied to clipboard

#### Return

The `AntBuilder` for this project. Never returns null.