nexus
Nexus Repository Manager
Overview
Nexus Repository Manager, developed by Sonatype, is a centralized repository manager for storing, managing, and distributing software artifacts and dependencies. It is widely used in modern software development to ensure reliable and consistent access to build outputs.
Key Features
Artifact Management
- Stores a variety of artifacts such as JARs, WARs, Docker images, npm packages, etc.
- Supports multiple package formats including Maven, Gradle, npm, NuGet, Docker, PyPI, and more.
Repository Proxying
- Caches external repositories (e.g., Maven Central, npm registry) locally to improve build performance and reliability.
Version Control for Artifacts
- Maintains different versions of libraries and components for easy retrieval and dependency management.
Security & Access Control
- Implements role-based access to manage read/write/delete permissions for users and teams.
CI/CD Integration
- Seamlessly integrates with Jenkins, GitLab CI, Bamboo, and other pipeline tools for storing and retrieving build artifacts.
Typical Usage in CI/CD
Build Stage
- Compiles code and generates artifacts (e.g.,
my-app-1.0.0.jar).
- Compiles code and generates artifacts (e.g.,
Upload to Nexus
- Pushes build artifacts to Nexus repositories such as
releasesorsnapshots.
- Pushes build artifacts to Nexus repositories such as
Dependency Resolution
- Future builds retrieve dependencies from Nexus instead of downloading them from external sources.
Docker Image Management
- Acts as a private Docker registry for storing and distributing container images.
Common Nexus Repositories
| Repository Type | Purpose |
|---|---|
| Maven/Gradle | Java artifacts |
| npm | Node.js packages |
| NuGet | .NET packages |
| Docker | Docker images |
| PyPI | Python packages |
Example: Maven Deployment to Nexus
<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>http://nexus.example.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://nexus.example.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>