bundles/org.eclipse.packagedrone.repo.importer.aether/src/org/eclipse/packagedrone/repo/importer/aether/AetherImporter.java
public static AetherResult prepareDependencies ( final Path tmpDir, final ImportConfiguration cfg ) throws RepositoryException
    {
        Objects.requireNonNull ( tmpDir );
        Objects.requireNonNull ( cfg );

        final RepositoryContext ctx = new RepositoryContext ( tmpDir, cfg.getRepositoryUrl (), cfg.isAllOptional () );

        // add all coordinates

        final CollectRequest cr = new CollectRequest ();
        cr.setRepositories ( ctx.getRepositories () );
        for ( final MavenCoordinates coords : cfg.getCoordinates () )
        {
            final Dependency dep = new Dependency ( new DefaultArtifact ( coords.toString () ), COMPILE );
            cr.addDependency ( dep );
        }

        final DependencyFilter filter = DependencyFilterUtils.classpathFilter ( COMPILE );
        final DependencyRequest deps = new DependencyRequest ( cr, filter );

        // resolve

        final DependencyResult dr = ctx.getSystem ().resolveDependencies ( ctx.getSession (), deps );
        final List<ArtifactResult> arts = dr.getArtifactResults ();

        if ( !cfg.isIncludeSources () )
        {
            // we are already done here
            return asResult ( arts, cfg, of ( dr ) );
        }

        // resolve sources

        final List<ArtifactRequest> requests = extendRequests ( arts.stream ().map ( ArtifactResult::getRequest ), ctx, cfg );

        return asResult ( resolve ( ctx, requests ), cfg, of ( dr ) );
    }
public static AetherResult prepareDependencies ( final Path tmpDir, final ImportConfiguration cfg ) throws RepositoryException
    {
        Objects.requireNonNull ( tmpDir );
        Objects.requireNonNull ( cfg );

        final RepositoryContext ctx = new RepositoryContext ( tmpDir, cfg.getRepositoryUrl (), cfg.isAllOptional () );

        // add all coordinates

        final CollectRequest cr = new CollectRequest ();
        cr.setRepositories ( ctx.getRepositories () );
        for ( final MavenCoordinates coords : cfg.getCoordinates () )
        {
            final Dependency dep = new Dependency ( new DefaultArtifact ( coords.toString () ), COMPILE );
            cr.addDependency ( dep );
        }

        final DependencyFilter filter = DependencyFilterUtils.classpathFilter ( COMPILE );
        final DependencyRequest deps = new DependencyRequest ( cr, filter );

        // resolve

        final DependencyResult dr = ctx.getSystem ().resolveDependencies ( ctx.getSession (), deps );
        final List<ArtifactResult> arts = dr.getArtifactResults ();

        if ( !cfg.isIncludeSources () )
        {
            // we are already done here
            return asResult ( arts, cfg, of ( dr ) );
        }

        // resolve sources

        final List<ArtifactRequest> requests = extendRequests ( arts.stream ().map ( ArtifactResult::getRequest ), ctx, cfg );

        return asResult ( resolve ( ctx, requests ), cfg, of ( dr ) );
    }
Prepare an import with dependencies
<p>
This method does resolve even transient dependencies and also adds the
sources if requested
</p>