title: How can I access Maven Artifact POM using Maven's Java API?
body: <p>I am attempting to retrieve the entire dependency tree and their poms starting at the root of the project.  I am starting with a POM already existing in my file system, but I'm not sure how to retrieve the dependency poms from the repository.</p>
  
  <p>I am using the following code to access the dependency list.  From the list I have all the information on the artifacts.  I'm just not sure how to access the repository.</p>
  
  <pre><code>FileReader reader = null;
  Model model = null;
  MavenXpp3Reader mavenreader = new MavenXpp3Reader();
  
  File pomfile = new File("pom.xml");
  
  model.setPomFile(pomfile);
  MavenProject project = new MavenProject(model);
  
  List&lt;Dependency&gt; deps = project.getDependencies();
  
  // Get dependency details
  for (Dependency d: deps) {          
      System.out.print(d.getArtifactId());
      System.out.print(":");
      System.out.println(d.getVersion()); 
  }           
  </code></pre>