Search in sources :

Example 1 with JavaEffectiveScopeCalculator

use of org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator in project karaf by apache.

the class Dependency30Helper method getDependencyTree.

private DependencyNode getDependencyTree(Artifact artifact) throws MojoExecutionException {
    try {
        CollectRequest collectRequest = new CollectRequest(new Dependency(artifact, "compile"), null, projectRepositories);
        DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(repositorySystemSession);
        session.setDependencySelector(new AndDependencySelector(new OptionalDependencySelector(), new ScopeDependencySelector1(), new ExclusionDependencySelector()));
        DependencyGraphTransformer transformer = new ChainedDependencyGraphTransformer(new ConflictMarker(), new JavaEffectiveScopeCalculator(), new JavaDependencyContextRefiner());
        session.setDependencyGraphTransformer(transformer);
        CollectResult result = repositorySystem.collectDependencies(session, collectRequest);
        return result.getRoot();
    } catch (DependencyCollectionException e) {
        throw new MojoExecutionException("Cannot build project dependency tree", e);
    }
}
Also used : JavaDependencyContextRefiner(org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner) DependencyCollectionException(org.sonatype.aether.collection.DependencyCollectionException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) CollectResult(org.sonatype.aether.collection.CollectResult) AndDependencySelector(org.sonatype.aether.util.graph.selector.AndDependencySelector) Dependency(org.sonatype.aether.graph.Dependency) CollectRequest(org.sonatype.aether.collection.CollectRequest) ChainedDependencyGraphTransformer(org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer) OptionalDependencySelector(org.sonatype.aether.util.graph.selector.OptionalDependencySelector) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) JavaEffectiveScopeCalculator(org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator) DependencyGraphTransformer(org.sonatype.aether.collection.DependencyGraphTransformer) ChainedDependencyGraphTransformer(org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer) ConflictMarker(org.sonatype.aether.util.graph.transformer.ConflictMarker) ExclusionDependencySelector(org.sonatype.aether.util.graph.selector.ExclusionDependencySelector)

Aggregations

MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 CollectRequest (org.sonatype.aether.collection.CollectRequest)1 CollectResult (org.sonatype.aether.collection.CollectResult)1 DependencyCollectionException (org.sonatype.aether.collection.DependencyCollectionException)1 DependencyGraphTransformer (org.sonatype.aether.collection.DependencyGraphTransformer)1 Dependency (org.sonatype.aether.graph.Dependency)1 DefaultRepositorySystemSession (org.sonatype.aether.util.DefaultRepositorySystemSession)1 AndDependencySelector (org.sonatype.aether.util.graph.selector.AndDependencySelector)1 ExclusionDependencySelector (org.sonatype.aether.util.graph.selector.ExclusionDependencySelector)1 OptionalDependencySelector (org.sonatype.aether.util.graph.selector.OptionalDependencySelector)1 ChainedDependencyGraphTransformer (org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer)1 ConflictMarker (org.sonatype.aether.util.graph.transformer.ConflictMarker)1 JavaDependencyContextRefiner (org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner)1 JavaEffectiveScopeCalculator (org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator)1