Maven: get all dependencies programmatically
<p>How can I programmatically get all dependencies of a Maven module outside a Maven execution environment?</p>

<p>So far I have:</p>

<p>via maven-core:</p>

<pre><code>Path pomPath = ...;
MavenXpp3Reader reader = new MavenXpp3Reader();
try (InputStream is = Files.newInputStream(pomPath)) {
    Model model = reader.read(is);
    this.mavenProject = new MavenProject(model);
}
</code></pre>

<p>and via jcabi-aether:</p>

<pre><code>File localRepo = Paths.get(System.getProperty("user.home"), ".m2").toFile();
new Classpath(mavenProject, localRepo, "runtime")
</code></pre>

<p>Is this generally correct so far?</p>

<p>The issue now is that I'm getting a NullPointerException:</p>

<pre><code>Caused by: java.lang.NullPointerException
    at com.jcabi.aether.Aether.mrepos(Aether.java:197)
    at com.jcabi.aether.Aether.&lt;init&gt;(Aether.java:140)
    at com.jcabi.aether.Classpath.&lt;init&gt;(Classpath.java:125)
</code></pre>

<p>since mavenProject.getRemoteProjectRepositories() returns null.</p>

<p>How can I initialze the MavenProject to contain the configured remote repos taking the settings.xml file (mirrors, proxies, repositories etc.) into account as well?</p>