Search in sources :

Example 1 with ChainedDependencyGraphTransformer

use of org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer in project fabric8 by jboss-fuse.

the class AetherBasedResolver method newRepositorySystemSession.

private static DefaultRepositorySystemSession newRepositorySystemSession() {
    DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
    DependencyTraverser depTraverser = new FatArtifactTraverser();
    session.setDependencyTraverser(depTraverser);
    DependencyManager depManager = new ClassicDependencyManager();
    session.setDependencyManager(depManager);
    DependencySelector depFilter = new AndDependencySelector(new ScopeDependencySelector("test", "provided"), new OptionalDependencySelector(), new ExclusionDependencySelector());
    session.setDependencySelector(depFilter);
    DependencyGraphTransformer transformer = new ConflictResolver(new NearestVersionSelector(), new JavaScopeSelector(), new SimpleOptionalitySelector(), new JavaScopeDeriver());
    new ChainedDependencyGraphTransformer(transformer, new JavaDependencyContextRefiner());
    session.setDependencyGraphTransformer(transformer);
    DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
    stereotypes.add(new DefaultArtifactType("pom"));
    stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
    stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java"));
    stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java"));
    stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", "java"));
    stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", "java"));
    stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", "java"));
    stereotypes.add(new DefaultArtifactType("java-source", "jar", "sources", "java", false, false));
    stereotypes.add(new DefaultArtifactType("war", "war", "", "java", false, true));
    stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true));
    stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true));
    stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true));
    session.setArtifactTypeRegistry(stereotypes);
    session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true));
    Properties sysProps = (Properties) System.getProperties().clone();
    session.setSystemProperties(sysProps);
    session.setConfigProperties(sysProps);
    // set timeout smaller than 30 minutes by default
    session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, TimeUnit.MINUTES.toMillis(5));
    return session;
}
Also used : JavaDependencyContextRefiner(org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner) ConflictResolver(org.eclipse.aether.util.graph.transformer.ConflictResolver) ClassicDependencyManager(org.eclipse.aether.util.graph.manager.ClassicDependencyManager) DependencyManager(org.eclipse.aether.collection.DependencyManager) JavaScopeDeriver(org.eclipse.aether.util.graph.transformer.JavaScopeDeriver) AndDependencySelector(org.eclipse.aether.util.graph.selector.AndDependencySelector) DependencyTraverser(org.eclipse.aether.collection.DependencyTraverser) ConfigurationProperties(org.eclipse.aether.ConfigurationProperties) ArtifactProperties(org.eclipse.aether.artifact.ArtifactProperties) Properties(java.util.Properties) FatArtifactTraverser(org.eclipse.aether.util.graph.traverser.FatArtifactTraverser) ChainedDependencyGraphTransformer(org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer) OptionalDependencySelector(org.eclipse.aether.util.graph.selector.OptionalDependencySelector) SimpleOptionalitySelector(org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector) NearestVersionSelector(org.eclipse.aether.util.graph.transformer.NearestVersionSelector) ClassicDependencyManager(org.eclipse.aether.util.graph.manager.ClassicDependencyManager) DefaultRepositorySystemSession(org.eclipse.aether.DefaultRepositorySystemSession) DefaultArtifactTypeRegistry(org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry) JavaScopeSelector(org.eclipse.aether.util.graph.transformer.JavaScopeSelector) AndDependencySelector(org.eclipse.aether.util.graph.selector.AndDependencySelector) ScopeDependencySelector(org.eclipse.aether.util.graph.selector.ScopeDependencySelector) OptionalDependencySelector(org.eclipse.aether.util.graph.selector.OptionalDependencySelector) ExclusionDependencySelector(org.eclipse.aether.util.graph.selector.ExclusionDependencySelector) DependencySelector(org.eclipse.aether.collection.DependencySelector) ChainedDependencyGraphTransformer(org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer) DependencyGraphTransformer(org.eclipse.aether.collection.DependencyGraphTransformer) DefaultArtifactType(org.eclipse.aether.artifact.DefaultArtifactType) SimpleArtifactDescriptorPolicy(org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy) ScopeDependencySelector(org.eclipse.aether.util.graph.selector.ScopeDependencySelector) ExclusionDependencySelector(org.eclipse.aether.util.graph.selector.ExclusionDependencySelector)

Aggregations

Properties (java.util.Properties)1 ConfigurationProperties (org.eclipse.aether.ConfigurationProperties)1 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)1 ArtifactProperties (org.eclipse.aether.artifact.ArtifactProperties)1 DefaultArtifactType (org.eclipse.aether.artifact.DefaultArtifactType)1 DependencyGraphTransformer (org.eclipse.aether.collection.DependencyGraphTransformer)1 DependencyManager (org.eclipse.aether.collection.DependencyManager)1 DependencySelector (org.eclipse.aether.collection.DependencySelector)1 DependencyTraverser (org.eclipse.aether.collection.DependencyTraverser)1 DefaultArtifactTypeRegistry (org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry)1 ClassicDependencyManager (org.eclipse.aether.util.graph.manager.ClassicDependencyManager)1 AndDependencySelector (org.eclipse.aether.util.graph.selector.AndDependencySelector)1 ExclusionDependencySelector (org.eclipse.aether.util.graph.selector.ExclusionDependencySelector)1 OptionalDependencySelector (org.eclipse.aether.util.graph.selector.OptionalDependencySelector)1 ScopeDependencySelector (org.eclipse.aether.util.graph.selector.ScopeDependencySelector)1 ChainedDependencyGraphTransformer (org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer)1 ConflictResolver (org.eclipse.aether.util.graph.transformer.ConflictResolver)1 JavaDependencyContextRefiner (org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner)1 JavaScopeDeriver (org.eclipse.aether.util.graph.transformer.JavaScopeDeriver)1 JavaScopeSelector (org.eclipse.aether.util.graph.transformer.JavaScopeSelector)1