ant-purifier full guide

Detailed setup, dependency management, build commands, and troubleshooting. Start with the overview for the initial commands; use the sections below for the complete setup and behavior. ant-purifier is classified at maturity tier 4 (see tier assessment for details).

Contents

Setup and activation

From a project with build.xml, ivy.xml, and an Ivy resolution target:

nix shell 'github:nix-purifiers/ant-purifier'
ant-purifier lock
ant-purifier prefetch
ant test

The default resolver target is resolve. Select another with ant-purifier --resolve-target dependencies lock. Commit ivy.lock.xml and ant-purifier.lock.json. The native Ivy lock records exact revisions; its companion records artifact hashes, original metadata, and the project configuration used to resolve them.

The shell provides an ant wrapper that selects the locked repository before running your targets. Without a lockfile it warns and runs ordinary Ant/Ivy. A stale or invalid lockfile fails with a request to run ant-purifier lock. The wrapper can also be installed through your usual Nix configuration.

ant-purifier update commons-lang3
ant-purifier update

A named update retains the other selected revisions. Running lock again retains existing pins, including when the companion needs regenerating. Use --property name=value for properties needed by your resolver target.

Version compatibility

Tool or language Packaged defaults Tested versions
Ant 1.10.18 1.5.4
Apache Ivy Project-selected 2.4.0
Java 21 6

Operating systems and architectures

OS CPU architecture Packaged toolchain Recorded workflow
Linux ARM64 Yes Not recorded
Linux x86-64 Yes Tested

Choosing versions

Component Selected by
Build tool / package manager: Apache Ant Select legacy-basic-v1 explicitly and supply the actual Ant package in the Nix scope; this opt-in profile is restricted to x86_64-linux.
Nix scope configuration: nativeProfile, ant
Build tool / package manager: Apache Ivy For legacy-basic-v1, supply the actual Ivy package in the same Nix scope; its native API and origin belong to the recorded tuple.
Nix scope configuration: apacheIvy
Runtime running the tool: JDK For legacy-basic-v1, supply a live SDK adapter with explicit manager executable and runtime home. Nix contexts retain the actual SDK inputs.
Nix scope configuration: legacyJvmAdapter
Project compiler: JDK For legacy-basic-v1, compilation must use the SDK home/compiler bound by the live adapter. It is a Nix value rather than a version string or serialized store path.
Nix scope configuration: legacyJvmAdapter
Project runtime: JDK Forked Java tasks in legacy-basic-v1 must use the adapter’s declared manager executable or runtime-home Java executable. The recorded tuple uses the same SDK for every role; independent runtime SDKs have no recorded point.
Nix scope configuration: legacyJvmAdapter

Requirements

Using locked dependencies

Dependency resolution

Locked, Nix-resolved dependencies for Ant and Apache Ivy.

Native Ant plugin

Projects can activate the plugin from their build instead of requiring the wrapper. Add its Maven repository to Ivy:

<ibiblio name="purifier" m2compatible="true"
  root="https://nix-purifiers.github.io/ant-purifier/maven"/>

Resolve io.github.nix-purifiers:ant-purifier at a published release version into a separate bootstrap classpath, then activate it before project resolution:

<taskdef uri="antlib:org.nixpurifiers.ant"
  resource="org/nixpurifiers/ant/antlib.xml"
  classpathref="purifier.bootstrap"/>
<purifier:activate
  xmlns:purifier="antlib:org.nixpurifiers.ant"/>

The release repository contains versioned JARs and POMs. Keep bootstrap dependencies separate from the application descriptor. Published plugins obtain their matching Nix runtime automatically. Maven resolution prints a warning that the plugin was resolved impurely and recommends the wrapper for pure plugin resolution.

Language tooling integration

Configure your Java language client to launch the supplied jdtls command. It prepares Eclipse project metadata with immutable dependency and source JAR paths, preserving existing IvyDE configuration for restoration when the lock is removed. JDT’s workspace is kept outside the source tree.

prefetch roots the dependency repository, compiler, Ant, plugin, and editor toolchain beside the selected lockfile so subsequent builds and editor sessions can run offline.

Nix builds

Apply overlays.default, then call the scoped builder:

pkgs.ant-purifier.buildAntProject {
  src = ./project;
  buildTargets = [ "test" ];
  publishTarget = "publish";
}

The result exposes packages, tests, release, and fetches. packages.project builds in the sandbox; packages.environment is the locked dependency repository. With publishTarget, packages.repository contains the project’s native Ivy publications, separate from downloaded dependencies. projections.maven and projections.ivy expose shared JVM publication views. Maven projection requires original Maven POM metadata, including parent and BOM closure; a graph available only as Ivy metadata fails explicitly.

The builder accepts external lockFile, ivyLock, ivyFile, and buildFile paths and caller-provided fetchers. The CLI equivalents are --lockfile, --native-lock, --ivy-file, and --build-file. A new external native lock starts from the working copy’s pins without overwriting its lockfiles.

Project projections

Use a producer package that exports projections.maven:

ant-purifier lock \
  --input 'github:owner/library/<rev>#library'
ant-purifier prefetch
ant test

The catalog selects supplied modules automatically, including their immutable Nix-derived versions. Keep the dependency declarations in ivy.xml; no version rewrite table is needed. Repeat --input for additional producers.

The companion lock records pinned Nix sources. Their artifacts and native version pins stay out of the download locks. Relocking retains the source pins; update refreshes them. Native resolution and editor metadata use the same selected files.

Nix builds read the recorded inputs by default. They can also take projectDependencies = [ producer.packages.${system}.library ];. Publication views include the supplied closure and rewrite descriptors for downstream tools.

Supported scope

Linux x86-64 and ARM64 are checked with Ant 1.10.18, Ivy 2.6.0, and JDK 21. The native plugin targets Java 11. Dependency sources currently use HTTP(S); private mirrors can be supplied through builder fetchers.

Inline Ivy resolution, inherited descriptors, branches, multiple project base directories, custom cache managers, and explicit artifact URLs are rejected. Arbitrary downloads performed by other Ant tasks need their own locked inputs.

Target systems

  • x86_64-linux
  • aarch64-linux