Documentation
¶
Overview ¶
Package maven is the format of maven, gradle, ivy and sbt repositories (decision 0036): Maven's naming predicates, the coordinates a repository's layout reads from a path, and the package index of decision 0018, kept by the hooks on every write path and rebuilt by Reindex.
A package is groupId:artifactId, from the layout's organisation and module; a version is the name of its version folder, so every unique build of 1.0-SNAPSHOT is a file of that one version; and versions order by model.CompareMercury, as Artifactory's metadata and searches do.
Role ¶
artifacts module, ecosystem layer: the format rules of the Maven slice, one format with four layouts (package types maven, gradle, ivy and sbt). Its Handler plugs into the item service through the format hooks (decision 0032), so every write, download and delete in a repository of the Maven group reaches it whichever API carried it. Its http subpackage, mavenhttp (artifacts/ecosystem/maven/http), serves the calculateMetadata and generatePom operations with this package. Its upstream rules make a remote repository of the Maven group retrieve, check and cache format-aware over core remote's shared retrieval and cache policy (decision 0007), which this package imports and which never imports it back (decision 0044).
Inputs ¶
- Driving: the format registry (artifacts/ecosystem), which hands the item service's hooks for the Maven group to Handler; the work queue, which runs the metadata rebuilds (KindMetadata, KindPlugins) and the maxUniqueSnapshots cleanup (KindSnapshots) through Handler.Work, the cleanup on the timer the application schedules; the server's Maven operations (CalculateMetadata, GeneratePOM), its remote downloads, which resolve version tokens and snapshots against the upstream's metadata (ResolveMavenSource), and its upstream version search (ReadSourceMetadata); and the application, which installs MavenBackend as the remote source service's backend and its PrepareUpload as the remote policy's hook, and starts MavenEager.
- Driven: the format hooks' environment (format.Env), through which Handler reads stored POMs, keeps the package index, writes the maven-metadata.xml files it derives as Deriver, enqueues its work and removes the snapshot builds the cleanup drops; the repository's layout (artifacts/core/layout), which reads coordinates from a path; core remote's policy (remote.Policy), through which MavenBackend reads, fetches checksum sidecars over the pooled upstream client and rechecks the read's authority (Check); the source service (source.Service), through which MavenMetadata and the companion jobs read; the persistent work queue (platform/work), which keeps the companion jobs; and the access API (access/api), which rechecks a job's principal when it runs.
Outputs ¶
- Naming: MetadataFile, Snapshot and SnapshotSuffix, the Is* path predicates (IsPom, IsMetadata, IsSnapshot, IsNonUniqueSnapshot and the rest), IsMavenLayout, UniqueBuild and ParseUniqueBuild.
- Coordinates and Read, a file's place in the package index, and Versions, a package's versions in Mercury order with their files.
- Handler: the hooks that inspect and admit a deploy, index it, resolve a download's version tokens and non-unique snapshot name, classify paths for replication, mark plugin POMs (PluginProperty) and derive maven-metadata.xml at the snapshot, artifact and plugin levels.
- CalculateMetadata and GeneratePOM, the work of the calculateMetadata and generatePom operations.
- The upstream rules: MavenBackend, the format-aware source backend of remote repositories of the Maven group, with its PrepareUpload, which adds the upstream's checksum sidecars to a newly fetched file; MavenEager, NewMavenEager and MavenCompanionKind, the durable queue that fetches a .pom's .jar and a .jar's sources eagerly; MavenMetadata and ResolveMavenSource, which read the upstream's maven-metadata.xml and resolve version tokens and snapshots from it; and their building blocks, SourceMetadata with SourceVersioning, SourceSnapshot and SourceSnapshotVersion, ReadSourceMetadata, ValidateRemote and ErrRemoteContent.
Invariants ¶
- Admit applies Artifactory's checks in its order: a blacked-out repository, the release and snapshot policy, the include and exclude patterns, then what each kind of write adds, a snapshot's name under the repository's snapshotVersionBehavior included.
- maven-metadata.xml is derived from the package index through the work queue, never on the write's path, and a read of it waits for the work it is owed (Owed); under deployer a deploy leaves the client's file, and only a delete has it rewritten.
- Snapshot renaming, checksum sidecar mapping and -SNAPSHOT resolution apply only under a layout equal to maven-2-default (IsMavenLayout).
- In a local repository or a remote's cache, a non-unique snapshot name and a version token resolve only to files the repository's include and exclude patterns accept, as JFrog says an excluded artifact is not resolved from the repository. A remote's maven-metadata.xml that its download policy refuses counts as absent, so the path is fetched as asked and its own check decides.
- Upstream metadata and POMs are bounded and checked before they are cached, and an invalid one is refused with ErrRemoteContent, which never echoes upstream XML.
- A companion job carries a credential reference, never a credential, and stops when the repository's credential revision changes (remote.EagerKey); its principal is rechecked when it runs, and at most 256 jobs are pending, leased or parked at once.
- The companion kind and its job's JSON are stored, so both stay byte-identical.
References ¶
- Decision 0036: docs/research/decisions/0036-maven.md, and research 27 (docs/research/27-maven.md).
- Decision 0032: docs/research/decisions/0032-package-format-handlers.md (format hooks and optional interfaces); decision 0018: docs/research/decisions/0018-package-index.md; decision 0033: docs/research/decisions/0033-persistent-work-queue.md.
- docs/operations/maven-remote-repositories.md (Maven, Gradle, Ivy and SBT remote repositories, #625) and decision 0007: docs/research/decisions/0007-remote-repositories.md (format rules classify and validate; core remote owns transport and cache policy).
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Artifacts and remote".
- JFrog's statements decision 0036 cites: metadata recalculated after a delete under deployer, and its fix, https://jfrog.atlassian.net/rest/api/2/issue/RTFACT-26651 and https://jfrog.atlassian.net/rest/api/2/issue/RTFACT-26126; plugin metadata, https://jfrog.atlassian.net/rest/api/2/issue/RTFACT-20623.
- The Maven repository metadata model: https://maven.apache.org/ref/3-LATEST/maven-repository-metadata/repository-metadata.html.
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 228 (ecosystem/maven, also gradle, ivy and sbt), line 381 (one format, four layouts), line 401 (the protocol's home, ecosystem/maven/http), line 655 (the upstream rules, which keep the names remote_backend.go and remote_eager.go here because remote.go was taken), line 664 (the P10 virtual.go) and lines 997 and 1014 (the mapping rows).
- Plan: docs/implementation/plan.md#p7-npm-go-maven-locals, #p9-remote-repositories and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/279 (metadata), https://github.com/weaveplatform/artifactweave/issues/282 (calculateMetadata and generatePom), https://github.com/weaveplatform/artifactweave/issues/283 (maxUniqueSnapshots), https://github.com/weaveplatform/artifactweave/issues/625 (remote retrieval), https://github.com/weaveplatform/artifactweave/issues/1019 and https://github.com/weaveplatform/artifactweave/issues/1020
Status ¶
Implemented P7, with remote retrieval in P9. Moved here in P9d. Roadmap: virtual.go (P10), the Merger that merges maven-metadata.xml for virtual repositories.
Testing ¶
- naming_test.go and coordinates_test.go: Maven's naming table, unique builds, the maven-2-default comparison and coordinates.
- admit_test.go and snapshot_test.go: POM checks and encodings, the release and snapshot policy, uploaded metadata and checksums, and snapshot naming under each snapshotVersionBehavior.
- handler_test.go and contract_test.go: indexing, classification and the layouts, and the format contract suite (artifacts/core/formattest) for maven, gradle, ivy and sbt.
- metadata_test.go and metadata_fault_test.go: the three metadata levels against the golden XML in testdata, deployer, concurrent deploys, work and queue failures.
- resolve_test.go: version tokens and snapshot resolution across layouts and repositories.
- cleanup_test.go: the maxUniqueSnapshots cleanup.
- rest_test.go: CalculateMetadata and GeneratePOM.
- remote_test.go: upstream metadata validation and the POM and JAR admission of a remote file.
- remote_backend_test.go: MavenBackend and the companion queue through core remote's policy against a fake upstream (checksum sidecar faults, metadata cache identity and layout mapping, a prepared adapter's admission kept, and companion authority, revocation, restart and retries); remote_fixture_test.go holds the policy fixture they share with nothing else.
Index ¶
- Constants
- Variables
- func CalculateMetadata(ctx context.Context, env format.Env, c repo.Config, folder string, ...) error
- func GeneratePOM(ctx context.Context, env format.Env, c repo.Config, jar model.Item) (string, []byte, error)
- func IsChecksum(p string) bool
- func IsClientPom(p string) bool
- func IsIndex(p string) bool
- func IsMavenLayout(l *layout.Layout) bool
- func IsMetadata(p string) bool
- func IsMetadataChecksum(p string) bool
- func IsNonUniqueSnapshot(p string) bool
- func IsPom(p string) bool
- func IsSnapshot(p string) bool
- func IsSnapshotMetadata(p string) bool
- func IsSnapshotVersion(version string) bool
- func IsUniqueSnapshot(p string) bool
- func IsUniqueSnapshotName(name string) bool
- func ResolveMavenSource(ctx context.Context, service *source.Service, items *item.Service, ...) (string, error)
- func Serves(t repo.PackageType) bool
- func ValidateRemote(ctx context.Context, c repo.Config, l *layout.Layout, path string, ...) error
- func Versions(ctx context.Context, st format.Store, c repo.Config, name string) ([]model.PackageVersion, map[int64][]model.Item, error)
- type Coordinates
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Annotated(ctx context.Context, env format.Env, c repo.Config, it model.Item, ...) error
- func (Handler) Classify(c repo.Config, p string) format.Class
- func (Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, removed []model.Item) error
- func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Owed(c repo.Config, cached bool, p string) []format.WorkRef
- func (Handler) OwnsSidecars()
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (Handler) Resolve(ctx context.Context, env format.Env, c repo.Config, d format.Download) (string, error)
- func (Handler) Work(ctx context.Context, env format.Env, it work.WorkItem) error
- func (Handler) WorkKinds() []string
- type MavenBackend
- type MavenEager
- type SourceMetadata
- type SourceSnapshot
- type SourceSnapshotVersion
- type SourceVersioning
- type UniqueBuild
Constants ¶
const ( // MetadataFile is maven-metadata.xml, at the snapshot, artifact or // plugin level. MetadataFile = "maven-metadata.xml" // Snapshot is the integration revision of a non-unique snapshot. Snapshot = "SNAPSHOT" // SnapshotSuffix ends a snapshot version, as in 1.0-SNAPSHOT. SnapshotSuffix = "-" + Snapshot )
Names Maven gives its files.
const ( // KindMetadata rebuilds a package's maven-metadata.xml files, its // artifact-level one and each snapshot folder's, keyed by // groupId:artifactId. KindMetadata = "maven.metadata" // KindPlugins rebuilds a group's plugin metadata, keyed by groupId. KindPlugins = "maven.plugins" )
The kinds of derived work the Maven format queues (decisions 0033 and 0036). A key is "<repository key>/<name>": repository keys hold no slash.
const Deriver = "_system_"
Deriver is recorded as the creator and modifier of the metadata the format writes: Artifactory's system user, SecurityService.USER_SYSTEM. It is how a run tells its own file from one a client uploaded, which it keeps when it has nothing to replace it with.
const KindSnapshots = "maven.snapshots"
KindSnapshots applies a package's maxUniqueSnapshots, keyed by groupId:artifactId (decision 0036, #283). It is periodic work: a deploy marks the package, and the runtime runs the marked packages on a timer (work.Queue.HandleEvery), as Artifactory 7.x marks the builds over the limit on deploy and deletes them in a background process every five minutes.
const MavenCompanionKind = "maven.remote-companion"
MavenCompanionKind is the persistent work-queue kind of a companion fetch (decision 0033), and the name of the lease that serializes their admission. It is stored with every queued job, so it never changes: a renamed kind would strand the jobs already queued.
const PluginProperty = "artifactory.maven.mavenPlugin"
PluginProperty marks a POM whose packaging is maven-plugin, as Artifactory's MavenPomInterceptor does (PropertiesService .MAVEN_PLUGIN_PROPERTY_NAME); the plugin-level metadata (#279) lists them.
Variables ¶
var ErrRemoteContent = errors.New("maven: invalid maven source content")
ErrRemoteContent identifies invalid source bytes without echoing upstream XML.
Functions ¶
func CalculateMetadata ¶
func CalculateMetadata( ctx context.Context, env format.Env, c repo.Config, folder string, recursive bool, ) error
CalculateMetadata does calculateMetadata's work on folder in c, a local repository of the Maven group (decision 0036, #282). In one transaction it brings the package index of the files under folder, or directly in it when recursive is false, back in line with the tree, as a reindex would, then queues the metadata of each package those files belong to, and of the package and group each maven-metadata.xml there describes, so a file with nothing left to describe is removed. The work runs when the queue reaches it, and a read of the metadata waits for it, so the answer need not wait: Artifactory's also answers once its calculation is queued.
func GeneratePOM ¶
func GeneratePOM( ctx context.Context, env format.Env, c repo.Config, jar model.Item, ) (string, []byte, error)
GeneratePOM returns where generatePom writes the POM of the file jar in c, and what it writes (decision 0036, #282): the jar's own META-INF/maven/<groupId>/<artifactId>/pom.xml for the coordinates its path gives, or a default POM. The path is the jar's descriptor path in the repository's layout, without its classifier, as the POM of a classifier artifact is its main artifact's. A file the layout reads no coordinates from, or a POM, is refused with 400.
func IsChecksum ¶
IsChecksum reports a checksum sidecar by its extension, with the algorithms item.Sidecar accepts.
func IsClientPom ¶
IsClientPom reports the pom.xml a project keeps beside its sources, which a jar carries under META-INF/maven.
func IsMavenLayout ¶
IsMavenLayout reports a layout equal to maven-2-default by value, name included, as RepoLayoutUtils.isDefaultM2 compares them: only under it does Artifactory rename snapshots, map their checksum sidecars and resolve -SNAPSHOT downloads to a unique build. A descriptor that edits maven-2-default turns those off; a copy of it under another name does not turn them on.
func IsMetadataChecksum ¶
IsMetadataChecksum reports a checksum sidecar of maven-metadata.xml.
func IsNonUniqueSnapshot ¶
IsNonUniqueSnapshot reports a file of a snapshot folder named with -SNAPSHOT before its classifier or extension, such as 1.0-SNAPSHOT/app-1.0-SNAPSHOT.jar.
func IsSnapshot ¶
IsSnapshot reports a snapshot file, unique or not, or a snapshot version folder.
func IsSnapshotMetadata ¶
IsSnapshotMetadata reports the maven-metadata.xml of a snapshot version folder.
func IsSnapshotVersion ¶
IsSnapshotVersion reports a non-unique snapshot version, such as 1.0-SNAPSHOT.
func IsUniqueSnapshot ¶
IsUniqueSnapshot reports a file of a snapshot folder whose name carries a timestamp and build number, such as 1.0-SNAPSHOT/app-1.0-20261017.090000-1.jar.
func IsUniqueSnapshotName ¶
IsUniqueSnapshotName reports a unique snapshot's file name.
func ResolveMavenSource ¶
func ResolveMavenSource( ctx context.Context, service *source.Service, items *item.Service, q source.Request, ) (string, error)
ResolveMavenSource uses authoritative metadata for Maven's changing version names. The caller must authorize the returned canonical path before fetching. Metadata the remote repository's own download policy refuses, as an exclude pattern of **/maven-metadata.xml does, counts as absent and the path is fetched as asked, so the file's own check decides: 6.20's RemoteLatestMavenVersionResolver reads it through the download service and takes any answer but 200 as no metadata (tryDownloadingMavenMetadata). 7.x's answer is to be captured (#216).
func Serves ¶
func Serves(t repo.PackageType) bool
Serves reports the package types of Artifactory's Maven group that artifactweave serves. p2, which Artifactory also counts, is only ever a remote or virtual repository.
func ValidateRemote ¶
func ValidateRemote( ctx context.Context, c repo.Config, l *layout.Layout, path string, r io.ReadSeeker, size int64, ) error
ValidateRemote checks complete source bytes before they can enter the cache or a no-store response. POM checks apply to the canonical repository layout.
func Versions ¶
func Versions( ctx context.Context, st format.Store, c repo.Config, name string, ) ([]model.PackageVersion, map[int64][]model.Item, error)
Versions returns the versions the index holds for package name in c, oldest first in Mercury order, as the artifact-level metadata lists them; none for a package the index does not know. Each comes with the files it links.
Types ¶
type Coordinates ¶
type Coordinates struct {
layout.Coordinates
// Package is groupId:artifactId, the layout's organisation with dots
// and its module.
Package string
// Version is the name of the version's folder, such as 1.0 or
// 1.0-SNAPSHOT.
Version string
}
Coordinates are a file's place in the package index (decision 0036): the layout's reading of its path, the package it belongs to and the version.
func Read ¶
func Read(l *layout.Layout, fullPath string) (Coordinates, bool)
Read returns the coordinates l reads from a repository-relative file path; ok is false when the file is no file of a version: the layout does not fit it or names no organisation, or it is metadata, a checksum or a Nexus index file, which belong to no version even where a layout would read one.
type Handler ¶
type Handler struct {
// The generic format's hooks, which Admit's own checks replace.
generic.Handler
}
Handler is the Maven format: its deploy rules (admit.go) and snapshot naming (snapshot.go), its download policy and version tokens (policy.go, resolve.go), the package index, and maven-metadata.xml derived through the work queue (work.go, #279).
func (Handler) Admit ¶
func (Handler) Admit( ctx context.Context, env format.Env, c repo.Config, w format.Write, ) (format.Write, error)
Admit applies Artifactory's checks in its order (RealRepoBase .assertValidPath, then UploadServiceImpl): a blacked-out repository, the release and snapshot policy, the include and exclude patterns, and then what each kind of write adds, a snapshot file's name under the repository's snapshotVersionBehavior included (snapshot.go).
func (Handler) Annotated ¶
func (Handler) Annotated( ctx context.Context, env format.Env, c repo.Config, it model.Item, a format.Annotation, ) error
Annotated queues a group's plugin metadata when a POM in it gains or loses PluginProperty, by a deploy's properties or later.
func (Handler) Classify ¶
Classify reports maven-metadata.xml as derived, since #279 writes it from the index and a replica recomputes it, except under deployer, where the client writes every level and only a delete has it rewritten; a non-unique snapshot and a Nexus index file as metadata, since a later deploy changes them under the same path; and every other file as unique.
func (Handler) Deleted ¶
func (Handler) Deleted( ctx context.Context, env format.Env, c repo.Config, removed []model.Item, ) error
Deleted syncs every version a removal touched with the tree: a version that kept files may have lost its earliest, which dates it. It queues each touched package's metadata, under deployer as well: JFrog says a deployer repository's metadata is recalculated when other files are deleted (RTFACT-26651), and 7.27.3 fixed that recalculation emptying it (RTFACT-26126). Deleting a maven-metadata.xml touches no version, so the client's file is not written back.
func (Handler) Deleting ¶
Deleting runs before a file is removed. The item service drops the file's version link with it; Deleted settles the rest. A plugin POM, whose mark goes with it, queues its group's plugin metadata here, under deployer too, as a delete there recalculates.
func (Handler) Deployed ¶
Deployed indexes a file stored in a version: the version is synced with the tree, so its date and files are what a reindex would read. It queues the package's metadata, whose run rebuilds the group's plugin metadata too, and a plugin POM queues its group's plugin metadata of its own, which a read of that file waits for. A snapshot build in a repository with maxUniqueSnapshots marks the package for its cleanup.
func (Handler) Inspect ¶
func (Handler) Inspect( ctx context.Context, env format.Env, _ repo.Config, w format.Write, ) (any, error)
Inspect reads the POM a deploy, copy or move lands, outside the write's transaction; Admit checks it and the index keeps what it names.
func (Handler) Owed ¶
Owed names the work a download of a maven-metadata.xml, or of its sidecar, waits for: a snapshot folder's belongs to its package, and any other may be its folder's artifact-level or plugin metadata, so it waits for both. Waiting for work no one asked for costs one lookup.
func (Handler) OwnsSidecars ¶
func (Handler) OwnsSidecars()
OwnsSidecars makes every upload named as a checksum sidecar in a Maven repository a checksum of its file, as in Artifactory, so one whose file is missing answers 404 rather than being stored.
func (Handler) Reindex ¶
Reindex rebuilds the repository's package index from its tree, in one transaction.
func (Handler) Resolve ¶
func (Handler) Resolve( ctx context.Context, env format.Env, c repo.Config, d format.Download, ) (string, error)
Resolve resolves a download's version tokens and non-unique snapshot name (resolveTokens), then refuses the resolved path when the repository's release and snapshot policy does, as Artifactory's assertValidPath does for downloads and deploys alike. The policy reads the resolved path: a [RELEASE] that names a release is a release download.
func (Handler) Work ¶
Work rebuilds the metadata one item names from the package index as it stands now, under deployer as under the other behaviours, since only a delete asks for it there, or applies the package's maxUniqueSnapshots. A repository that is gone, or no longer a local repository of the Maven group, owes nothing.
type MavenBackend ¶
type MavenBackend struct {
Policy *remote.Policy
Eager func(context.Context, source.Request, source.Permit)
}
MavenBackend opts only Maven-family routes into format-aware source retrieval. Other adapters keep the shared policy's existing behavior.
func (*MavenBackend) PrepareUpload ¶
func (m *MavenBackend) PrepareUpload( ctx context.Context, q source.Request, permit source.Permit, opts remote.Options, u *item.CacheUpload, ) error
PrepareUpload retrieves optional external checksum files only for a newly fetched representation. Warm cache hits need no sidecar requests; pass-thru additionally preserves each available upstream digest. Every auxiliary call uses the same guarded transport and deadline.
func (*MavenBackend) Read ¶
func (m *MavenBackend) Read( ctx context.Context, q source.Request, permit source.Permit, ) (source.Result, error)
Read answers q through the shared policy. For a Maven-family repository it first prepares the request: maven-metadata.xml is fetched as metadata and a non-unique snapshot as mutable, the path is mapped to the upstream's layout when the repository names another, and the body must pass ValidateRemote before it is cached, or the read fails with a 502 integrity failure. After a GET or HEAD that answered with the cached file, while the upstream may be reached, it hands the read to Eager to queue the file's companion. Other package types, and metadata a protocol adapter has already prepared, go to the policy unchanged.
type MavenEager ¶
type MavenEager struct {
// contains filtered or unexported fields
}
MavenEager persists deduplicated companion work without retaining credentials. Two workers share the regular source admission limits. Pending/leased/parked jobs together are bounded to 256; failures park after three attempts. Shutdown returns interrupted leases so another process can safely resume them.
func NewMavenEager ¶
func NewMavenEager( ctx context.Context, service *source.Service, policy *remote.Policy, authn accessapi.Authenticator, authz accessapi.Authorizer, log *slog.Logger, ) (*MavenEager, error)
NewMavenEager starts two workers that fetch, through service and under policy, the companions that Queue records, on a work queue over the policy's store. A job runs as the principal whose read queued it, rechecked when it runs: authn's Current must still accept that principal's credential and authz must still grant it, or the job fails permanently with source.ErrDenied, as does one whose repository no longer fetches it (offline, blacked out or not caching). A job whose repository is gone, or whose source or credential revision changed, fails permanently with source.ErrSuperseded; any other failure is retried, three attempts in all, before the job is parked. Queue admits no job while 256 are pending, leased or parked. NewMavenEager returns an error when the queue or its handler cannot be set up.
func (*MavenEager) Close ¶
func (e *MavenEager) Close()
Close stops the workers and returns once every run has settled; the leases of runs it cuts short are handed back, so another process can resume those jobs. A nil MavenEager closes as a no-op.
func (*MavenEager) Queue ¶
Queue records, at most once, the companion of the file q read: the .jar of a .pom when the repository fetches jars eagerly, and the -sources.jar of a .jar when it fetches sources eagerly. The job holds the caller's credential reference and the credential revision, never a credential. Queue does nothing inside a companion job (remote.EagerKey set), for a file with no companion or a caller with no principal, when the policy's options or its Check fail, or when 256 jobs are pending, leased or parked; a failure to record the job is not reported, since the read it follows has already succeeded.
type SourceMetadata ¶
type SourceMetadata struct {
XMLName xml.Name `xml:"metadata"`
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Versioning SourceVersioning `xml:"versioning"`
}
SourceMetadata is the authoritative version source consumed by native Maven resolution and P9 upstream version search. It never reads the local package index and therefore includes versions with no cached binaries.
func MavenMetadata ¶
func MavenMetadata( ctx context.Context, service *source.Service, q source.Request, metadataPath string, ) (SourceMetadata, error)
MavenMetadata reads source metadata for both token resolution and the #213 upstream-version consumer. It never populates a binary to discover a version.
func ReadSourceMetadata ¶
func ReadSourceMetadata(r io.Reader) (SourceMetadata, error)
ReadSourceMetadata bounds XML before parsing it; the original representation is retained separately and served without rewriting to the cached subset.
type SourceSnapshot ¶
type SourceSnapshot struct {
Timestamp string `xml:"timestamp"`
BuildNumber int `xml:"buildNumber"`
}
SourceSnapshot is a SNAPSHOT version's <snapshot>: the timestamp and build number of its newest unique build. Old Maven repositories publish only this, so it names the build when SourceVersioning.Snapshots is empty; it says nothing of which extensions or classifiers exist.
type SourceSnapshotVersion ¶
type SourceSnapshotVersion struct {
Classifier string `xml:"classifier"`
Extension string `xml:"extension"`
Value string `xml:"value"`
}
SourceSnapshotVersion is one <snapshotVersion>: Value is the unique version (such as 1.0-20260101.120000-3) of the artifact with this classifier and extension, which a request for the SNAPSHOT file resolves to.
type SourceVersioning ¶
type SourceVersioning struct {
Latest string `xml:"latest"`
Release string `xml:"release"`
Versions []string `xml:"versions>version"`
Snapshot SourceSnapshot `xml:"snapshot"`
Snapshots []SourceSnapshotVersion `xml:"snapshotVersions>snapshotVersion"`
}
SourceVersioning is the <versioning> of an upstream maven-metadata.xml: latest and release, which resolve the [LATEST] and [RELEASE] tokens, the version list an upstream version search reads, and, in a SNAPSHOT version's metadata, its newest build (Snapshot) and the unique build of each artifact (Snapshots). Fields the upstream leaves out are empty.
type UniqueBuild ¶
UniqueBuild is the timestamp and build number a unique snapshot's file name carries.
func ParseUniqueBuild ¶
func ParseUniqueBuild(name string) (UniqueBuild, bool)
ParseUniqueBuild reads the build from a unique snapshot's file name; ok is false for any other name.
func (UniqueBuild) String ¶
func (b UniqueBuild) String() string
String is the build's part of a file name, as in 20261017.090000-1.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mavenhttp serves Maven's REST operations over the item kit: calculateMetadata, which queues the maven-metadata.xml rebuild of a folder and, unless noneRecursive is true, of everything under it; and generatePom, which writes the POM of a deployed jar through the item service.
|
Package mavenhttp serves Maven's REST operations over the item kit: calculateMetadata, which queues the maven-metadata.xml rebuild of a folder and, unless noneRecursive is true, of everything under it; and generatePom, which writes the POM of a deployed jar through the item service. |