Java Code Examples for org.eclipse.aether.graph.DependencyNode#getDependency()
The following examples show how to use
org.eclipse.aether.graph.DependencyNode#getDependency() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArtifactProblem.java From cloud-opensource-java with Apache License 2.0 | 6 votes |
private static boolean equalsOnDependencies( List<DependencyNode> listA, List<DependencyNode> listB) { int size = listA.size(); if (listB.size() != size) { return false; } for (int i = 0; i < size; i++) { DependencyNode nodeA = listA.get(i); DependencyNode nodeB = listB.get(i); Dependency dependencyA = nodeA.getDependency(); Dependency dependencyB = nodeB.getDependency(); if (!Objects.equals(dependencyA, dependencyB)) { return false; } } return true; }
Example 2
Source File: BuildDependencyGraphVisitor.java From quarkus with Apache License 2.0 | 6 votes |
private void visitLeave(DependencyNode node) { final Dependency dep = node.getDependency(); if (dep == null) { return; } final Artifact artifact = dep.getArtifact(); if (artifact.getFile() == null) { requests.add(new ArtifactRequest(node)); } if (deploymentNode != null) { if (runtimeNode == null && !appDeps.contains(new AppArtifactKey(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension()))) { //we never want optional deps on the deployment CP if (!node.getDependency().isOptional()) { deploymentDepNodes.add(node); } } else if (runtimeNode == node) { runtimeNode = null; runtimeArtifact = null; } if (deploymentNode == node) { deploymentNode = null; } } }
Example 3
Source File: DependencyGraphBuilder.java From cloud-opensource-java with Apache License 2.0 | 5 votes |
private DependencyNode resolveCompileTimeDependencies( List<DependencyNode> dependencyNodes, DefaultRepositorySystemSession session) throws DependencyResolutionException { ImmutableList.Builder<Dependency> dependenciesBuilder = ImmutableList.builder(); for (DependencyNode dependencyNode : dependencyNodes) { Dependency dependency = dependencyNode.getDependency(); if (dependency == null) { // Root DependencyNode has null dependency field. dependenciesBuilder.add(new Dependency(dependencyNode.getArtifact(), "compile")); } else { // The dependency field carries exclusions dependenciesBuilder.add(dependency.setScope("compile")); } } ImmutableList<Dependency> dependencyList = dependenciesBuilder.build(); if (localRepository != null) { LocalRepository local = new LocalRepository(localRepository.toAbsolutePath().toString()); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, local)); } CollectRequest collectRequest = new CollectRequest(); if (dependencyList.size() == 1) { // With setRoot, the result includes dependencies with `optional:true` or `provided` collectRequest.setRoot(dependencyList.get(0)); } else { collectRequest.setDependencies(dependencyList); } for (RemoteRepository repository : repositories) { collectRequest.addRepository(repository); } DependencyRequest dependencyRequest = new DependencyRequest(); dependencyRequest.setCollectRequest(collectRequest); // resolveDependencies equals to calling both collectDependencies (build dependency tree) and // resolveArtifacts (download JAR files). DependencyResult dependencyResult = system.resolveDependencies(session, dependencyRequest); return dependencyResult.getRoot(); }
Example 4
Source File: BuildDependencyGraphVisitor.java From quarkus with Apache License 2.0 | 5 votes |
private void visitEnter(DependencyNode node) { final Dependency dep = node.getDependency(); if (deploymentNode == null) { runtimeArtifact = DeploymentInjectingDependencyVisitor.getRuntimeArtifact(node); if (runtimeArtifact != null) { deploymentNode = node; } } else if (runtimeArtifact != null && runtimeNode == null && runtimeArtifact.equals(dep.getArtifact())) { runtimeNode = node; } }
Example 5
Source File: BootstrapAppModelResolver.java From quarkus with Apache License 2.0 | 5 votes |
private static void collect(List<DependencyNode> nodes, List<AppDependency> appDeps) { for (DependencyNode node : nodes) { collect(node.getChildren(), appDeps); final Dependency dep = node.getDependency(); appDeps.add(new AppDependency(toAppArtifact(node.getArtifact()), dep.getScope(), dep.isOptional())); } }