Opscraft
Build tools & artifact repositories · Lesson 4 of 9 · 3 min read

Artifact repositories: Nexus, Artifactory, CodeArtifact

Repository types

Type Purpose
Hosted / local Stores your own artifacts (releases, snapshots, internal npm packages)
Proxy / remote Caches an upstream (Maven Central, npmjs, PyPI, Docker Hub)
Group / virtual One URL that aggregates hosted and proxy repositories in order
Enlarge diagramCI and laptopsgroup / virtualone URLhosted: releasesimmutablehosted: snapshotscleaned up oftenproxy: Maven Centralcached copiesproxy: npmjscached copies
Figure 1. Repository types. Builds use one group URL; the manager serves your own artifacts and caches public ones.
Swipe sideways to see all of it, or tap to open it full screen.

Developers and CI point at the group URL only; the repository manager serves internal artifacts and caches public ones.

Benefits of proxying everything:

  • Speed and resilience — builds don't depend on Maven Central or npm being up; cached artifacts stay available.
  • Control — block or quarantine packages (licence or vulnerability policies via Nexus Firewall/IQ or JFrog Xray/Curation).
  • Auditability — know exactly which external packages your org consumes.
  • Dependency confusion protection — a public package with the same name as an internal one can't sneak in if internal namespaces resolve only from hosted repos (routing rules / exclusive namespaces).

Products

  • Sonatype Nexus Repository — popular, OSS and Pro editions; Maven, npm, PyPI, Docker, Helm, raw and more; cleanup policies; Pro adds HA and staging.
  • JFrog Artifactory — broad format support, virtual repos, Xray scanning, replication, build info (links artifacts to CI builds and dependencies), commonly used in larger enterprises.
  • AWS CodeArtifact — managed, serverless; supports Maven, Gradle, npm, pip/twine, NuGet, Swift, Ruby, Rust (Cargo) and generic packages; domains (shared storage and policy across accounts) contain repositories with upstreams (including external connections to public registries); auth via IAM and short-lived tokens. No container images — use ECR for those.

CodeArtifact usage:

export CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
  --domain acme --domain-owner 111122223333 --query authorizationToken --output text)
# Maven/Gradle use the token as the password for user "aws";
# the endpoint comes from:
aws codeartifact get-repository-endpoint --domain acme --repository shared --format maven
# npm / pip can be configured in one step:
aws codeartifact login --tool npm --domain acme --repository shared

Tokens last up to 12 hours; CI gets them through its IAM role (OIDC), so there are no long-lived publish credentials.

Retention and cleanup

Repositories grow without bound unless you set policies: delete SNAPSHOTs older than N days or keep the last N per version, purge unused proxy cache entries, keep releases forever (or per compliance), and compact blob stores. For ECR, lifecycle policies expire untagged images and keep the last N tagged images per repo.

High availability and backup

The repository manager becomes a critical dependency of every build: run it HA (Nexus Pro/Artifactory HA, or managed CodeArtifact), back up its database and blob store (S3-backed blob stores help), and monitor disk, latency and error rates.