tags:

views:

72

answers:

2

How can I enforce Maven to only use my local repository and single specific repository on intranet and not downloading anything from internet? Even my POMs all has single company's internal repository specified, maven goes to internet repositories taken from libs' POM files to fetch dependencies.

+1  A: 

Have a look at this article.

Bozhidar Batsov
This seems to be about using only your local (on own computer) repo, not about using an intranet (company) repo.
Kris
Oh dear, use a file: URL to point at a local directory. That is a very bad idea.
tobrien
It's actually not that bad, but everyone is entitled to an opinion...
Bozhidar Batsov
+3  A: 

In your settings.xml (usually under %user.home%/.m2) you can configure this.

E.g.

<mirrors>
    <mirror>
      <id>repo.example.com</id>
      <mirrorOf>*</mirrorOf>
      <name>Internal repo</name>
      <url>http://repo.example.com/repo&lt;/url&gt;
    </mirror>
</mirrors>

The key part there is the <mirrorOf>*</mirrorOf> which means that all requests will be directed at this repository.

Kris
I've tried and it did worked out. I will wait a bit before marking this as solution, since it looks like hack - I was hoping for some specific option or cmd line param etc. Thanks for solving my practical issue anyways!
Igor Romanov
This isn't a hack at all, this is how you configure a global repository manager. It is what we recommend people to do when they've setup something like Nexus.
tobrien