Quick revision
The short answer
We run a repository manager such as Nexus or Artifactory with proxy repositories for Central and vendors, hosted repositories for internal releases and snapshots, and one group repository that is the only mirror every build uses. We prevent dependency confusion by reserving internal groupIds and routing them only to hosted repositories, scan artifacts for vulnerabilities and licences at the proxy and in CI, make release repositories immutable with checksums and signatures, and run the manager with high availability and backups because every build depends on it.
What to remember
In this answer, we designed an artifact setup around a repository manager with proxy, hosted and group repositories, and a single mirror for every build. We blocked dependency confusion by reserving internal groupIds and routing them only to hosted repositories, scanned artifacts at the proxy and in CI, made releases immutable with checksums and signatures, and ran the manager with high availability and tested backups.
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.
We run a repository manager such as Nexus or Artifactory with proxy repositories for Central and vendors, hosted repositories for internal releases and snapshots, and one group repository that is the only mirror every build uses. We prevent dependency confusion by reserving internal groupIds and routing them only to hosted repositories, scan artifacts for vulnerabilities and licences at the proxy and in CI, make release repositories immutable with checksums and signatures, and run the manager with high availability and backups because every build depends on it.
Why this question is asked
With 500 developers and 800 builds, the artifact repository becomes the most shared piece of build infrastructure in the company. Every build reads from it, every release writes to it, and every malicious or vulnerable package on the internet tries to get through it. Interviewers ask this design question to see whether we can combine availability, security and convenience in one setup. In this answer, we will lay out the repositories and how builds use them, look at how dependency confusion works and how to block it, add scanning and immutability, and make the whole thing reliable.
1The Building Blocks of a Repository Manager
A repository manager offers three kinds of repository. A proxy repository fronts a remote one, such as Maven Central: on the first request it downloads the artifact, stores it, and serves the stored copy from then on. A hosted repository stores artifacts that we publish ourselves, such as our internal libraries. A group repository combines several others behind a single URL, so a build asks one place and the manager looks in each member in order.
For our company, that gives proxies for Central and for the few vendor repositories we really need, hosted repositories for internal releases and internal snapshots, and one group, for example maven-all, that contains them.
- Builds and developersone mirror in
settings.xml: maven-all - Group maven-allsingle URL, routing rules decide which member serves what
- Hosted: internal-releases, internal-snapshotsonly CI may deploy; releases immutable
- Proxies: central, vendor-xcached copies of public artifacts, scanned
- Storage and databasereplicated, backed up
5 layers, from the top down. Step through them one at a time.
2One Mirror for Every Build
Every build, on developer machines and on CI, uses a settings.xml with a single mirror whose mirrorOf is *, pointing at the group. This matters for security as much as speed: if any POM declares its own repository, the mirror still captures the request, so no build reaches the internet directly. We can then block direct access to Central at the network level, and the repository manager becomes the one controlled door.
Deploying is separate from reading. Only CI pipelines have credentials to deploy, released artifacts go to internal-releases, and snapshots go to internal-snapshots. Developers can read everything but publish nothing, so every internal release is traceable to a pipeline run.
3How Dependency Confusion Works
Dependency confusion is an attack where someone publishes a package to a public repository using the same name as one of our internal packages, often with a higher version number. If our repository manager looks in both the hosted and the proxy repositories and picks the highest version, or the first match from the public side, our builds download the attacker's code.
Maven Central requires publishers to prove they own a groupId's namespace, usually through a domain, which makes this harder than on some other ecosystems. But we should not depend on that alone: an internal groupId that does not match a domain we own, such as acme.internal, or a typo of a real groupId, can still be claimed.
5 messages in order. Play them, or step through them one at a time.
Without the routing rule, the group would also ask the central proxy.
4Blocking It With Reserved GroupIds and Routing Rules
The fix has two parts. First, we reserve our namespaces: all internal artifacts use groupIds under a domain we own, such as com.acme, and we register that namespace on Central ourselves so nobody else can publish under it. Second, we configure routing rules in the repository manager: requests for com.acme.* are served only by the hosted repositories and never forwarded to any proxy, and the proxies are configured to refuse com.acme.* requests. Nexus calls these routing rules; Artifactory uses include and exclude patterns per repository. Check the exact feature names for your product and version.
With this in place, even an attacker who manages to publish com.acme.payments:client:99.0 somewhere public cannot reach our builds, because the manager never asks a public repository for that group.
5Scanning, Immutability and Signatures
Vulnerable and malicious packages are a wider risk than dependency confusion. We scan at two points. At the proxy, firewall features such as Sonatype Repository Firewall or JFrog Xray can check artifacts as they are first downloaded and quarantine known malicious or badly licensed ones before any build gets them. In CI, a tool such as OWASP Dependency-Check, or the scanner built into our platform, checks each build's full dependency list and fails or warns on known vulnerabilities. Licence policies, for example no AGPL in distributed products, are enforced in the same places.
Internal release repositories must be immutable: the manager refuses a redeploy of an existing release version. Otherwise someone could replace orders-client 2.3.0 with different contents and nobody would know. The manager stores and checks checksums for every file, and we can go further by signing release artifacts in the pipeline and verifying signatures of third-party artifacts where publishers provide them.
6Availability and Backups
Once every build goes through the repository manager, an outage stops all 800 builds and every deployment that needs an artifact. So we run it in a highly available setup, with several nodes behind a load balancer and shared, replicated storage, as the product supports, and monitor request latency and error rates like any production service.
We back up both the stored artifacts and the manager's database, and test restores, because internal releases exist nowhere else. Proxied artifacts can be downloaded again, but losing them during an incident on the public side would hurt too, so they are backed up as well. Finally, we size it for the load: 800 builds with caching produce many requests at peak times, so caching on CI agents and a nearby location for each CI region keep latency low.
7Follow-up questions
Should developers be able to deploy snapshots from their laptops?
I would avoid it. If only CI deploys, every artifact in the repository came from a known commit and pipeline, which makes audits and incident analysis simple. Developers who want to test a change in another service can install it locally with mvn install or use a branch build from CI.
How long do you keep snapshots?
Not long. Snapshots pile up quickly, so a cleanup policy removes snapshot builds older than, say, 14 days or keeps only the last few per version. Releases are kept indefinitely, or at least as long as any deployed system might need them.
What do you do when a scan finds a critical vulnerability in a widely used artifact?
We first use our SBOMs or the repository manager's usage data to find which builds use it, then update the platform BOM and open automated pull requests. Blocking the artifact at the proxy immediately would break every build that uses it, so blocking is usually for malicious packages, while vulnerable ones get a fix deadline.
8Conclusion
In this answer, we designed an artifact setup around a repository manager with proxy, hosted and group repositories, and a single mirror for every build. We blocked dependency confusion by reserving internal groupIds and routing them only to hosted repositories, scanned artifacts at the proxy and in CI, made releases immutable with checksums and signatures, and ran the manager with high availability and tested backups.
Open with
I would put a repository manager such as Nexus or Artifactory at the centre. It has proxy repositories for Maven Central and the few vendor repositories we need, hosted repositories for internal releases and internal snapshots, and one group repository that combines them.
Then, if they want more
Every build, on CI and on laptops, uses a settings.xml with a single mirror, mirrorOf star, pointing at that group, and we block direct internet access to Central so the manager is the only door. Only CI pipelines can deploy.
For dependency confusion, the attack where someone publishes a public package with our internal name and a higher version, I would reserve our groupIds under a domain we own, register the namespace on Central, and configure routing rules so com.acme requests are only ever answered by the hosted repositories and never by a proxy.
For malicious and vulnerable packages, I would scan at the proxy with a firewall feature like Repository Firewall or Xray, and again in CI with OWASP Dependency-Check or similar, including licence policies. Release repositories must be immutable, with no redeploys, checksums verified and ideally signed artifacts.
And because all 800 builds depend on it, the manager needs high availability, monitoring, backups of storage and database with tested restores, and enough capacity near each CI region.
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
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 "Design the artifact repository setup for 500 developers and 800 Maven builds, including...": https://scrivio-interview-library.netlify.app/java/maven/2f3d2e5f80/