Search code examples
javamaven-3artifactory

making multiple maven mirror repositories


I have set up an artifactory and made 3 repositories in it namely A,B and C. Now in my settings.xml file I have configured A to be a mirror of everything as:

<mirror>
      <id>myRepo</id>
      <name>remote repo</name>
      <url>http://<url>:<port>/artifactory/A</url>
      <mirrorOf>*</mirrorOf> 
</mirror>

Now each time I build , maven only looks for artifacts under A and not those under B or C . So is there a way to ensure that B and C are also looked up alongwith A? I tried keeping multiple entries for mirror but since each would have same <mirrorOf> values so it wouldn't be picked up by Maven. I came across this : Maven doc to mirror and found that , "A single mirror can handle multiple repositories when used in conjunction with a repository manager." Since I am already using an artifactory with 3 repositories, I can't figure out how to configure it there?


Solution

  • You should define a virtual repository, which will resolve to A, B and C and configure your mirror settings to this repository. The simplest way to get your settings file right is just to generate it in Artifactory.

    P.S. Please also note the caveat when using mirror-any.