micfra
micfra

Reputation: 2820

How-to force maven to use repository from settings only

Is there any way to force maven to use repositories configured in its settings.xml only? I want to avoid that maven loads files from repositories which are configured in any pom configuration especially from dependencies.

Upvotes: 4

Views: 2188

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328830

Set up your own Maven mirror / repository server and use the <mirror> setting to redirect all requests to it as described in the documentation: http://maven.apache.org/guides/mini/guide-mirror-settings.html

Usually, you want mirrorOf=*:

<settings>
  ...
  <mirrors>
    <mirror>
      <id>internal-repository</id>
      <name>Maven Repository Manager running on repo.mycompany.com</name>
      <url>http://repo.mycompany.com/proxy</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

That means all requests go to your Maven proxy server which can then decide how to answer them.

Upvotes: 7

Related Questions