Bruno D. Rodrigues
Bruno D. Rodrigues

Reputation: 390

How to avoid maven to request private artifacts from public repositories?

I have a pom file with my own repository as first, and a set of public repositories next (repo1, repo2, java.net, etc.). Let's assume all are "release" repositories.

My problem is that maven does a request into all repositories looking for our internal jars, either to download the jar the first time, or to verify the metadata.xml if the versioning is a range like "(1.0.0,1.1.0]".

How can I apply some kind of filters to state something like the groupID foo.bar belong only to the repository "foo".

This case bothers me for two reasons: one is that it's a waste of bandwidth to do these requests into the public servers (and when a server is slow, it just slows down everything), and second it exposes the name of our internal packages into the outside world's log files.

I don't want to deploy a local proxy or anything like that, just want a certain groupID (or list of) to always go to a certain repository. Even for non private artifacts, it would help to specify that a certain artifact is on a certain repository, for such artifacts that are not on the public generic ones (repo.maven, download.java), and hence avoid those redundant requests.

Upvotes: 4

Views: 385

Answers (1)

Michał Kalinowski
Michał Kalinowski

Reputation: 17943

We use internal Nexus instance and have such thing configured there. Nexus has it at Administration -> Routing option where you can define masks for groupId and point which repositories should be used then.

Of course it needs internal Nexus to be the only repository used by developers and then configure any external repositories to be proxied or mirrored.

Upvotes: 2

Related Questions