Answers: <p>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.</p>
  
  <p>So, here's what you need to do in order to populate Artifactory with your dependencies:</p>
  
  <ol>
  <li>Make sure that your virtual repository contains Maven Central or JCenter remotes.</li>
  <li>Configure your Maven to work with Artifactory (<a href="https://www.jfrog.com/confluence/display/RTF/Using+Artifactory#UsingArtifactory-SetMeUp" rel="nofollow noreferrer">The "Set Me Up" button in the Artifactory UI</a>)</li>
  <li>Delete the <code>~/.m2/repositories</code> cache</li>
  <li>Run your build again.</li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-20T15:59:27.440Z
Answers: 2019-02-20T15:59:27.440Z
Answers: JBaruch
Body: <p>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 <a href="https://repo.maven.apache.org" rel="nofollow noreferrer">repository</a> and placed the dependencies under .m2 cache but not in our artifactory instance.</p>
  
  <p>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?</p>
  
  <p>Here's the list of our repositories:</p>
  
  <pre><code>Local
   - wellows
  Remote
   - wellows-remote
  Virtual
   - wellows-virtual
  </code></pre>
  
Tags: <maven><java><artifactory>
Title: Maven dependencies that are downloaded not available in JFrog Artifactory server
UserDisplayName: Vivek
ThreadText: # Maven dependencies that are downloaded not available in JFrog Artifactory server
  
  (Asked by: username_0 on 2019-02-07)
  
  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](https://repo.maven.apache.org) 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
  
  ```
  
  **Tags:** maven, java, artifactory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-20. Score: 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](https://www.jfrog.com/confluence/display/RTF/Using+Artifactory#UsingArtifactory-SetMeUp))
  3. Delete the `~/.m2/repositories` cache
  4. Run your build again.
  
  
  ---
  
  