0

I am trying to set up maven with 2 repositories - jcenter & nexus. From nexus, we don't have the ability to proxy to jcenter. Hence I need a set up which can do the following-

  • If a artifact is found in nexus, download it.
  • If not found, go to jcenter to download artifact.

With the below settings.xml, it seems like maven only tries to download from central (which is set to bintray here, because its a super set of maven central). How can I tell maven to look in central and nexus?

Note- I have tried <mirrorOf>central, !nexus</mirrorOf>

 <mirrors>
   <mirror>
      <id>bintray</id>
      <name>bintray</name>
      <url>http://jcenter.bintray.com</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
    <mirror>
      <id>nexus</id>
      <mirrorOf>!bintray, *</mirrorOf>
      <url>http://some/url/goes/here</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>allow-snapshots</id>
      <activation><activeByDefault>true</activeByDefault></activation>
      <repositories>
        <repository>
            <id>jcenter</id>
            <url>http://jcenter.bintray.com</url>
        </repository>
      </repositories>
    </profile>
  </profiles>
zooes
  • 1,280
  • 3
  • 15
  • 21
  • Please have a look at if that help http://maven.apache.org/guides/mini/guide-multiple-repositories.html – Rizwan Apr 15 '18 at 18:43
  • Thank you, I had already visited the website and updated my settings.xml, but didnt work for me. – zooes Apr 15 '18 at 20:05
  • "!bintray,*" will work, provided that you have a repository definition with ID of "bintray" in your settings.xml file. Not sure about that leading space you have in front of the asterisk though, it might be problem? – rseddon Apr 16 '18 at 12:43
  • rseddon, thanks, I didnt realize that the space could be problem. Ill check it out and let you know if I have luck. – zooes Apr 16 '18 at 13:43
  • Here is my repository settings and I corrected the space with no luck. Do you see anything with settings that needs to be corrected? ` allow-snapshots true bintray http://jcenter.bintray.com true true ` – zooes Apr 16 '18 at 13:48

1 Answers1

0

I got it working by specifying multiple repo's in my parent pom. multiple repos in settings.xml had no effect on maven.

zooes
  • 1,280
  • 3
  • 15
  • 21