Search code examples
mavenartifactsnexus3

pulling artifacts from a second nexus


I have 2 artifact repositories in a close environment.
One is used for developers to download artifacts and the second to pull artifacts from the outside world.
Every time that a user wants to download a new artifact that are not presented in the first Nexus, the user will need to supply a request to integration team and after some policy the new artifact should be downloaded by the second nexus with user name and password of an integration team member.
We want to accomplish one Nexus that will pull artifact from a second Nexus only if it exist. If not - the developer will not be able to pull the artifact.
Any idea how to accomplish this step?


Solution

  • OK, We managed to accomplished it in the following way:
    We have Nexus 3 - we have a proxy repository (we will call it repo A)that allowed connecting the outside world.
    We have Nexus 2 - we define a proxy repository (we will call it repo B) that will set repo A as a remote.
    We define another proxy repository (we will call it repo C) that will set repo B as a remote. Editing the remote path for repo C that it would point repo B-Fake.

    Now, the developer's settings.xml will define only repo C.
    In case a new request for new artifact will come, we will use an integration pom with the new artifact when our settings.xml is pointing directly to repo B. Once repo B is cashed with the new artifact we change the remote of repo B to point repo A-Fake.
    Now change the setting to point repo C and changing its remote path to point repo B. And now repo C is cashed with the new artifact and we can set all the repos as they were before.

    Hope it will help someone :-)