Class SnapshotMetadataHealer

java.lang.Object
network.ike.plugin.deploy.SnapshotMetadataHealer

public final class SnapshotMetadataHealer extends Object
Repairs a snapshot version's maven-metadata.xml whose checksum sidecars no longer match it, so the next deploy can proceed (IKE-Network/ike-issues#1160).

Nexus rebuilds metadata in the background after a deploy and can rewrite a version's maven-metadata.xml without writing a matching .sha1 (IKE-Network/ike-issues#1107). The next deploy of that version downloads the pair, fails checksum validation, and stops; nothing on the client side repairs it. Deleting the metadata and its sidecars lets that deploy write them fresh, because the metadata is derived from the version's files and carries nothing of its own.

The healer touches only <group>/<artifact>/<version>/maven-metadata.xml and its .sha1, .md5, .sha256 and .sha512 sidecars, only for a -SNAPSHOT version, and only when a sidecar that is present disagrees with the XML. Artifacts and release versions are never touched. A repository that cannot be read is reported and left to the deploy, which reports the underlying problem itself.

  • Constructor Details

    • SnapshotMetadataHealer

      public SnapshotMetadataHealer(HttpClient client, Duration timeout)
      Creates a healer.
      Parameters:
      client - the HTTP client to reach the repository with
      timeout - the timeout for each request
  • Method Details

    • heal

      public SnapshotMetadataHealer.Result heal(URI repository, Optional<SnapshotMetadataHealer.Credentials> credentials, String groupId, String artifactId, String version)
      Checks one version's metadata and repairs it when a checksum sidecar disagrees with it.
      Parameters:
      repository - the deploy repository's base URL
      credentials - the repository credentials, or empty to send none
      groupId - the artifact's group id
      artifactId - the artifact id
      version - the version being deployed
      Returns:
      what was found and done