Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between using a single repository and a single mirror

Tags:

maven

The maven documentation says:

http://maven.apache.org/guides/mini/guide-mirror-settings.html

Using A Single Repository. You can force Maven to use a single repository by having it mirror all repository requests. The repository must contain all of the desired artifacts, or be able to proxy the requests to other repositories. This setting is most useful when using an internal company repository with the Maven Repository Manager to proxy external requests.

To achieve this, set mirrorOf to *.

<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>

I don't understand this paragraph.

Shouldn't it be something like this?

Using A Single Mirror You can force Maven to use a single mirror by having it mirror all repository requests. The mirror must contain all of the desired artifacts for all the repositories, or be able to proxy the requests to other repositories. This setting is most useful when using an internal company repository with the Maven Repository Manager to proxy external requests. To achieve this, set mirrorOf to *.

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

Where is my miss-understanding?

I mean, <mirror><id>internal-repository</id>... seems just wrong to me.

like image 400
David Portabella Avatar asked Apr 17 '13 14:04

David Portabella


People also ask

What is the difference between mirror and repository in Maven?

Mirror means a repository that is used as a passerelle/proxy to an other repository. When using a repository manager like Nexus, Artiafactory, Archiva... you dispose of one local entreprise repository wich proxifies remotes ones. So there is no need to declare too many repositories in your pom or setting.

What does it mean to mirror a repository?

Mirror a Repository Repository mirroring in Space allows you to create and maintain a synchronized copy of a repository hosted outside of Space. Mirrored repositories are synchronized in both directions. You can push commits to your Space mirror and they will be delivered to the remote repository.

Why do we need local repository in Maven?

A repository in Maven holds build artifacts and dependencies of varying types. There are exactly two types of repositories: local and remote: the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.


1 Answers

Mirror means a repository that is used as a passerelle/proxy to an other repository. When using a repository manager like Nexus, Artiafactory, Archiva... you dispose of one local entreprise repository wich proxifies remotes ones. So there is no need to declare too many repositories in your pom or setting.xml. Using Just one mirror which redirect all requests to the repository manager you have will be sufficient. That is the meaning of the documentation.

like image 143
napilioni Avatar answered Oct 20 '22 20:10

napilioni