The ant plugin

The ant plugin is useful for Apache Ant-based parts and is commonly used to build Java projects with the Ant snap.

This plugin installs the specified version of ant and runs the configured build. Any jar files created by the build inside the target directory, directly inside the root of the source tree, will be copied to ${SNAP}/jar in the resulting archive.

CLASSPATH will be set to the list of jars in ${SNAP}/jar and bin/java is available as a symlink to the installed version of OpenJDK.

This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.

This plugin is only available to core22 and core18 based snaps. See Base snaps for details.

base: core22 and base: core18

This plugin uses the following plugin-specific keywords:

  • ant-build-targets (list of strings) Run the given ant targets.

  • ant-buildfile (string) The path, relative to the root of the source tree, to the Ant buildfile to use. Defaults to a build.xml file in the root of the source tree.

  • ant-channel (string) When not using the Ant tarball from the Ant archive (see ant-version and ant-version-checksum above), this keyword specifies the channel to use for Apache Ant in the Snap Store. Defaults to latest/stable.

  • ant-openjdk-version (string) OpenJDK version available to the base to use. If not set the latest version available to the base will be used.

  • ant-properties (object) A dictionary of key-value pairs. Set the following properties when
    running ant.

  • ant-version (string) The version of ant you want to use to build the source artefacts.
    Defaults to the current release downloadable from https://archive.apache.org/dist/ant/binaries/.

  • ant-version-checksum (string) The checksum for ant-version in the form of /.
    Example: sha512/2a803f578f341e164f6753e410413d16ab60fab...

For examples, search GitHub for projects already using the plugin.

ⓘ This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.

After https://github.com/snapcore/snapcraft/pull/2596 has been merged the docs need to be updated as well:

- ant-buildfile
  (string)
  The path to the Ant buildfile to use, relative to the root of the
  source tree
  Defaults to a build.xml file in the root of the source tree.

is what I put into the Python docs.

In addition I think it would be useful if the page said what the plugin actually does :slight_smile:

Maybe something llike:

This plugin installs the specified version of Apache Ant and runs the configured build. Any jar files created by the build inside the target directory directly inside the root of the source tree will be copied to ${SNAP}/jar in the resulting archive. CLASSPATH will be set to the list of jars in ${SNAP}/jar and bin/java is available as a symlink to the installed version of OpenJDK.

1 Like

I’ll add this now, along with your suggestion for what the plugin actually does. Thank you, and thanks for letting us know!