3 Replies Latest reply on Feb 5, 2015 5:05 AM by dhladky

    Artificer as a Nexus proxy repository

    brmeyer

      [ARTIF-581] Finish the Maven Facade - JBoss Issue Tracker will complete a "Maven facade", a servlet that can be directly used as a Maven repository (both for retrieval and deployment).  In addition, the idea of using Artificer as a Nexus proxy repository has been brought up multiple times, and I think it would be incredibly powerful.  Now that the facade is working, sticking Nexus in front of it *should* be doable.

       

      However, I'm hitting a few unexpected details.  First, when the Artificer Maven facade URL is added to Nexus (and when Nexus periodically refreshes the list), it appears to call the facade and look for /.meta/* artifacts.  For the most part, I believe I can safely 404 those and everything will still work, but correct me if I'm wrong.  Second, I naively hoped that Nexus would simply look for a single artifact in Artificer *as needed*.  Instead, it appears that Nexus simply calls the root URL in an attempt to index everything that's available.  Faking out that list is going to be exceedingly difficult to get correct.  Any ideas?  Any way to configure Nexus differently?

        • 1. Re: Artificer as a Nexus proxy repository
          dhladky

          It is exactly as you say. If you request a file that is not yet stored in Nexus proxy repository, Nexus asks the remote repository for it. However directory listings are additions, that are only available for already cached artifacts in Nexus. So if you downloaded one file from the proxy, the directory listing would contain that single file even if the remote repository has a zillion of files in the same directory level. If you have not downloaded any file at all at the specific level, you get 404, because the directory does not exist in the cache and Nexus does not query the remote.

          • 2. Re: Artificer as a Nexus proxy repository
            brmeyer

            David, thanks for the response!  What I'm currently seeing is Nexus making GET calls to the root URL of my facade, in addition to requesting [ROOT URL]/.meta/prefixes.txt (and a few other .meta files).  I can't find a combination that will progress any further (have tried simple 200 with no content, 404, faking out some content, etc).  Nexus simply states that the remote is unavailable.

             

            Any idea where I might be able to find a solid list of what Nexus expects to be available?

            • 3. Re: Artificer as a Nexus proxy repository
              dhladky

              I do not have a full list of things Nexus can require, but /.meta/prefixes.txt is a quite useful thing I think you should replicate. See an example here https://repository.jboss.org/nexus/content/repositories/releases/.meta/prefixes.txt

               

              It is a list of available paths so Nexus does not need to connect the remote if the requested artifact is not within the list of known directories. For example "/org/infinispan" is in the list so Nexus will try to find the file, its path starts with /org/infinispan/ . On the other hand if your requested artifact would start with "/porn/stars/", Nexus will not query for the artifacts, because it knows such artifacts are not on the remote repositories.

               

              I think if you do not serve the file, it will try to get the requested artifacts always. However if you return empty file, it is possible Nexus would think your repository is completely empty and will not bother requesting anything and it returns 404 immediately.