0

I have the following repositories structure created in my newly installed Artifactory instance. And we are using this artifactory instance to store the Maven artifacts. Most of our projects are in Java and we use Maven as the build tool. As this is a new installation our .m2 repository cache is empty and when we did our initial 'mvn compile' it has downloaded all the dependencies from Maven Central repository and placed the dependencies under .m2 cache but not in our artifactory instance.

According to our understanding, we thought if the dependencies are not available in Artifactory server then it downloads from a public repository and then it keeps a copy in Artifactory server and also in a local .m2 cache. Is that how it works? When the dependencies are downloaded from public repository we also wanted to have that available in our artifactory server so that when a Maven is installed in a new machine then it should get that dependency from our Artifactory server itself. Is that possible?

Here's the list of our repositories:

Local
 - wellows
Remote
 - wellows-remote
Virtual
 - wellows-virtual
2

In order Artifactory to cache your dependencies, you need to retrieve them from Artifactory. Once you use your virtual repository, which contains the Maven Central remote, Artifactory will download the dependencies from Maven Central and will cache them for the future use.

So, here's what you need to do in order to populate Artifactory with your dependencies:

  1. Make sure that your virtual repository contains Maven Central or JCenter remotes.
  2. Configure your Maven to work with Artifactory (The "Set Me Up" button in the Artifactory UI)
  3. Delete the ~/.m2/repositories cache
  4. Run your build again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.