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;
}
Aggregations