src/main/java/com/simpligility/maven/plugins/android/common/DependencyResolver.java
public Set<Artifact> getLibraryDependenciesFor( MavenSession session,
                                                    RepositorySystem repositorySystem,
                                                    Artifact artifact )
            throws MojoExecutionException
    {
        // Set a filter that should only return interesting artifacts.
        final ArtifactFilter filter = new ArtifactFilter()
        {
            @Override
            public boolean include( Artifact found )
            {
                final String type = found.getType();
                return ( type.equals( APKLIB ) || type.equals( AAR ) || type.equals( APK ) );
            }
        };

        log.debug( "MavenSession = " + session + "  repositorySystem = " + repositorySystem );

        final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
        request.setArtifact( artifact );
        request.setResolveRoot( false );        // Don't include source artifact in result
        request.setResolveTransitively( true ); // Include direct plus transitive dependencies.
        request.setServers( session.getRequest().getServers() );
        request.setMirrors( session.getRequest().getMirrors() );
        request.setProxies( session.getRequest().getProxies() );
        request.setLocalRepository( session.getLocalRepository() );
        request.setRemoteRepositories( session.getCurrentProject().getRemoteArtifactRepositories() );

        final ArtifactResolutionResult result = repositorySystem.resolve( request );

        final Set<Artifact> libraryDeps = new HashSet<Artifact>();
        for ( final Artifact depArtifact : result.getArtifacts() )
        {
            if ( filter.include( depArtifact ) )
            {
                libraryDeps.add( depArtifact );
            }
        }

        return libraryDeps;
    }
public Set<Artifact> getLibraryDependenciesFor( MavenSession session,
                                                    RepositorySystem repositorySystem,
                                                    Artifact artifact )
            throws MojoExecutionException
    {
        // Set a filter that should only return interesting artifacts.
        final ArtifactFilter filter = new ArtifactFilter()
        {
            @Override
            public boolean include( Artifact found )
            {
                final String type = found.getType();
                return ( type.equals( APKLIB ) || type.equals( AAR ) || type.equals( APK ) );
            }
        };

        log.debug( "MavenSession = " + session + "  repositorySystem = " + repositorySystem );

        final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
        request.setArtifact( artifact );
        request.setResolveRoot( false );        // Don't include source artifact in result
        request.setResolveTransitively( true ); // Include direct plus transitive dependencies.
        request.setServers( session.getRequest().getServers() );
        request.setMirrors( session.getRequest().getMirrors() );
        request.setProxies( session.getRequest().getProxies() );
        request.setLocalRepository( session.getLocalRepository() );
        request.setRemoteRepositories( session.getCurrentProject().getRemoteArtifactRepositories() );

        final ArtifactResolutionResult result = repositorySystem.resolve( request );

        final Set<Artifact> libraryDeps = new HashSet<Artifact>();
        for ( final Artifact depArtifact : result.getArtifacts() )
        {
            if ( filter.include( depArtifact ) )
            {
                libraryDeps.add( depArtifact );
            }
        }

        return libraryDeps;
    }
Returns the Set of APKLIB, AAR, APK (direct or transitive) dependencies of the supplied artifact.

The project is searched until artifact is found and then the library dependencies are looked for recursively.

@param session           MavenSession in which to resolve the artifacts.
@param repositorySystem  RepositorySystem with which to resolve the artifacts.
@param artifact          Artifact for whom to get the dependencies.
@return Set of APK, APKLIB and AAR dependencies.
@throws org.apache.maven.plugin.MojoExecutionException if it couldn't resolve any of the dependencies.