Child pages
  • Ant Plugin
Skip to end of metadata
Go to start of metadata

View Ant Plugin on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

Description

This plugin adds Apache Ant support to Jenkins.This functionality used to be a part of the core, but as of Jenkins 1.431, it was split off into separate plugins.

Installation and usage

Installation

For this plugin to be used, an Ant installation must be specified in the global Jenkins configuration. It can be installed automatically:

Or manually:

Usage

  • Ant Version: Ant Installation to use. See previous section.
  • Targets: Ant targets to invoke. If left blank, default target will be invoked.
  • Build File: Build file to use. If left blank, plugin will look for build.xml in the root directory.
  • Properties: Additional parameters (typical properties file format) to pass to the build. They are passed like -D(name)=(value)
  • Java Options: Custom ANT_OPS.

 

An example of using the Ant task inside Pipeline DSL. This code snippet must be put inside a step block when using the declarative syntax.

withAnt(installation: 'myinstall') {
dir("scoring") {
if (isUnix()) {
sh "ant mytarget"
    } else {
bat "ant mytarget"
}
}

Change Log

Version 1.8 (Jan 22, 2018)

Version 1.7 (Aug 21, 2017)

Version 1.6 (Aug 08, 2017)

Now requires Jenkins 1.642.x or newer.

Version 1.5 (May 9, 2017)

  • Add description to POM [JENKINS-40002]
  • Ant plugin does not correctly resolve and property resolving empty build parameter [JENKINS-41801]
  • AntInstallation not setting PATH+ANT [JENKINS-42382]
  • Improve test coverage

Version 1.4 (Aug 30, 2016)

  • Descriptors annotated with @Symbol [JENKINS-37388]
  • Update test dependencies.

Version 1.3 (May 11, 2016)

Version 1.2 (Feb 20, 2013)

  • Mmproved documentation
  • Translations
  • Label in Plugin Manager

Version 1.1 (Sep 19, 2011)

  • First release, split off from the core.

Version 1.0 (Sep 19, 2011)

  • Erroneous release. Initial release is 1.1

2 Comments

  1. The properties line is only an edit line as shown in the Targets image above. There is no way I can enter properties each on their own line and there is no way to expand the properties line. Also it appears like the properties I set are not getting into Ant. I can see the command line and the properties have values but my variables are not getting those values. I place a space in between each variable. I wish I could enter each property on a separate line. I'm using the latest Java/tomcate and using Ant 1.9.3. All three of the properties below are getting passed into the buildlabel property. 


    Build Label = 15 buildnum=4.2.0.15 branch=CIP4-2
    Branch Name = $branch

    VersionBuild Num = $buildnumDist = E:\Dist\CIP_tool\$branch\15 buildnum=4.2.0.15 branch=CIP4-2

    The properties line for me looks like this:
    buildlabel=$BUILD_ID buildnum=$JOB_REVISION.$BUILD_NUMBER branch=$branchname

    I would prefer:

    buildlabel=$BUILD_ID

    buildnum=$JOB_REVISION.$BUILD_NUMBER

    branch=$branchname

  2. Hi there,

    I have uploaded ant plugin and trying to setup ant build for my project.  I have unselected install automatically option.  Not sure what to give in ANT_HOME.

    Please suggest.

    Thanks,

    Ashuthosh

Write a comment…