module

Krikri::PluginHelpers::MavenArtifactCommand

MavenArtifactCommand - the pure logic of community.general.maven_artifact, split out of the plugin so the repo-path arithmetic, the generated filenames, the maven-metadata.xml parsing (latest version, snapshot resolution) and the checksum comparison are unit-testable without a Maven repository. The plugin executes the HTTP/file transfers.

Constants

SNAPSHOT_TIMESTAMP_RE = /^(.*-)?([0-9]{8}\.[0-9]{6}-[0-9]+)$/

Artifact#path: group_id with dots -> slashes, then artifact_id, then the version directory - except timestamped snapshot versions ("1.2.3-20240101.123456-7" or "x-1.2.3-..."), whose directory keeps the "SNAPSHOT" spelling (real module's timestamp_version_match rewrite).

Class methods

artifact_path(group_id : String, artifact_id : String, version : String | Nil, with_version : Bool = true) : String
Source
checksum_matches?(local_checksum : String, remote_checksum : String) : Bool

is_invalid_checksum: the remote checksum file may carry a trailing filename; only the first token compares, case insensitively.

Source
dest_filename(dest : String, artifact_id : String, version_part : String | Nil, classifier : String | Nil, extension : String, keep_name : Bool) : String
Source
generated_filename(artifact_id : String, classifier : String | Nil, extension : String) : String

Artifact#_generate_filename / get_filename: when dest is a directory, the artifact lands under its generated name; keep_name keeps the version part of it.

Source
latest_version(metadata_xml : String) : String | Nil
Source
snapshot_timestamp_version(metadata_xml : String, version : String) : String | Nil

The timestamp/buildNumber fallback, given the base version string ("1.2.3-SNAPSHOT") and the metadata contents.

Source
snapshot_version(metadata_xml : String, classifier : String, extension : String) : String | Nil

Snapshot resolution for find_uri_for_artifact: prefer the snapshotVersions entry matching classifier+extension, else the timestamp/buildNumber fallback (version.replace("SNAPSHOT", "TIMESTAMP-BUILDNUM")).

Source