Quick revision
The short answer
A repository manager such as Nexus or Artifactory sits between our builds and public repositories. It proxies and caches Maven Central and others, so builds are faster and keep working when an upstream repository is slow or down; it hosts our own internal releases and snapshots; and it gives security one place to block or quarantine components and an audit trail of what was used. Builds are pointed at it with a mirror in Maven's settings.xml (mirrorOf) or a single repository in Gradle's settings, usually one group URL that combines everything.
What to remember
In this answer, we saw that a repository manager such as Nexus or Artifactory proxies and caches public repositories so builds are faster and survive upstream outages, hosts internal releases and snapshots, and acts as a security control point with blocking, quarantine and an audit trail. Builds use it through a Maven mirror with mirrorOf * in settings.xml or central repository settings in Gradle, typically pointing at one group URL.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A repository manager such as Nexus or Artifactory sits between our builds and public repositories. It proxies and caches Maven Central and others, so builds are faster and keep working when an upstream repository is slow or down; it hosts our own internal releases and snapshots; and it gives security one place to block or quarantine components and an audit trail of what was used. Builds are pointed at it with a mirror in Maven's settings.xml (mirrorOf) or a single repository in Gradle's settings, usually one group URL that combines everything.
Why this question is asked
In a small project, letting Maven download straight from Maven Central works fine. In a company with hundreds of developers and CI agents, it becomes slow, fragile and invisible: every build reaches the internet, a Central outage stops all delivery, internal libraries need somewhere to live, and nobody can say which components came in. Interviewers ask this question to see whether we understand the repository manager as infrastructure with several distinct jobs. In this answer, we will see how builds resolve artifacts, then go through the jobs: proxy and cache, hosting internal artifacts, security control, and how builds are configured to use it.
1A Quick Recap: How Builds Find Artifacts
Maven and Gradle resolve each dependency by its coordinates, groupId, artifactId and version, and download it from the repositories the build is configured with. Downloaded files land in a local cache on the machine (~/.m2/repository for Maven, ~/.gradle/caches for Gradle). A developer's laptop keeps that cache for a long time, but CI agents are often fresh containers that start with an empty cache, so every build downloads hundreds of jars again.
By default, Maven uses only Maven Central, and Gradle uses whatever repositories the build script declares. Without a repository manager, that means every developer and every CI agent talks directly to public servers on the internet.
- Developers and CI agentsconfigured with one URL: the group repository
- Group repositoryone URL that searches the repositories below in order
- Hosted repositoriesinternal releases and snapshots, uploaded by our pipelines
- Proxy repositoriescached copies of Maven Central, Gradle Plugin Portal, vendors
- Public repositories on the internetreached only by the repository manager
5 layers, from the top down. Step through them one at a time.
2Job 1: Proxy and Cache Public Repositories
A proxy repository forwards a request to the public repository the first time an artifact is asked for, stores the file, and serves it from its own storage after that. Because released artifacts never change, a cached jar can be served forever. A company network then downloads spring-core 6.2.x from the internet once, not ten thousand times.
Two benefits follow. Builds are faster, because the repository manager is on the local network and serves files at internal speeds. And builds survive upstream problems: if Maven Central is slow, rate-limits the company, or is briefly unreachable, the cached artifacts are still available, so most builds continue. Being a polite user of Central also matters, since it is a shared public service that limits abusive traffic.
3Job 2: Host Internal Artifacts
Our own libraries need a place to be published so other teams can depend on them. A hosted repository is that place. Companies usually have two kinds: a releases repository, where each version can be uploaded once and never changed, and a snapshots repository, where versions ending in -SNAPSHOT can be overwritten many times a day as development builds. Maven's distributionManagement section, or Gradle's publishing block, points to these.
Notice that the releases repository refuses to overwrite a version. That rule is important: if 1.4.0 could be replaced, two builds of the same service could contain different code under the same version, which breaks reproducibility and confuses incident analysis.
4Job 3: A Control Point for Security
Because every download goes through one system, the repository manager is also where security policies can act. Commercial features such as Sonatype's repository firewall or JFrog Xray can scan components as they are requested and block or quarantine ones with known critical vulnerabilities, unacceptable licenses, or signs of malicious packages, before they ever reach a build. Even without those features, the repository manager keeps logs of which artifacts were downloaded and by whom, which helps answer questions during an incident.
It is also the place to defend against dependency confusion, where an attacker publishes a public package with the same name as an internal one: the repository manager can be configured so that internal group ids are served only from the hosted repositories, never from a proxy.
5Configuring Builds to Use It
To make every build go through the repository manager, we configure a mirror. In Maven, a mirror in settings.xml with mirrorOf set to * sends requests for every repository, including Central and any repository declared in a pom, to one URL, which is usually a group repository that combines the proxies and hosted repositories. In Gradle, we declare the repositories centrally in settings.gradle.kts and forbid projects from adding their own.
Notice that the credentials live in the user's settings file or environment variables, never in the project. The server id matches the mirror id, which is how Maven knows which credentials to send. Gradle builds also need plugin repositories, which is why pluginManagement points to a proxy of the Gradle Plugin Portal.
6Follow-up questions
What is the difference between a proxy, a hosted and a group repository?
A proxy repository caches a remote repository such as Maven Central. A hosted repository stores artifacts we upload ourselves, such as internal releases and snapshots. A group repository is a single URL that searches several proxy and hosted repositories in a defined order, so builds need only one URL. The order matters for performance and security, for example putting hosted repositories first.
What happens if the repository manager itself is down?
Builds that need artifacts not already in their local cache fail, so the repository manager becomes critical infrastructure. Companies run it with high availability, back up the hosted repositories, which are the only copy of internal releases, and monitor it like any production service. CI agents can also keep a warm local cache to reduce the impact of short outages.
Why not just commit the jars into the repository?
That was common before Maven, and it causes problems: binary files bloat the repository, versions and licenses become invisible, there is no transitive resolution, and upgrades mean copying files by hand. A repository manager gives the reliability benefit of having the artifacts locally while keeping proper dependency management.
7Conclusion
In this answer, we saw that a repository manager such as Nexus or Artifactory proxies and caches public repositories so builds are faster and survive upstream outages, hosts internal releases and snapshots, and acts as a security control point with blocking, quarantine and an audit trail. Builds use it through a Maven mirror with mirrorOf * in settings.xml or central repository settings in Gradle, typically pointing at one group URL.
Open with
A repository manager like Nexus or Artifactory sits between all our builds and the public repositories, and it does three jobs. First, it proxies and caches Maven Central, the Gradle Plugin Portal and vendor repositories.
Then, if they want more
Each artifact is downloaded from the internet once and then served from the local network, so builds are much faster, especially on CI agents that start with an empty cache, and they keep working if Central is slow or unreachable.
Second, it hosts our own artifacts: a releases repository where each version can be uploaded once and never overwritten, and a snapshots repository for development builds.
Third, it is a control point for security: every component passes through it, so we can block or quarantine components with critical vulnerabilities, bad licenses or signs of malware, we have an audit trail of what was downloaded, and we can stop internal group ids from ever being fetched from public proxies.
To make builds use it, Maven gets a mirror in settings.xml with mirrorOf set to star, pointing at one group URL, with credentials from environment variables; in Gradle I declare the repositories in settings.gradle.kts and set FAIL_ON_PROJECT_REPOS so projects cannot bypass it.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Maven guides, Gradle user manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Why do companies run an artifact repository manager such as Nexus or Artifactory instead...": https://scrivio-interview-library.netlify.app/java/dependency-and-supply-chain/a01ad25042/