本文整理汇总了Java中org.eclipse.aether.graph.DependencyNode.getArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java DependencyNode.getArtifact方法的具体用法?Java DependencyNode.getArtifact怎么用?Java DependencyNode.getArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.aether.graph.DependencyNode
的用法示例。
在下文中一共展示了DependencyNode.getArtifact方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemoteURLs
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private List<URL> getRemoteURLs(final List<DependencyNode> nodes) throws IOException {
final List<URL> urls = new ArrayList<URL>();
for (DependencyNode node : nodes) {
final Artifact artifact = node.getArtifact();
boolean added = false;
for (RemoteRepository repository : node.getRepositories()) {
if (!added) {
final URL url = constructRemoteURL(artifact, repository);
added |= URLUtils.ping(url, URL_PING_TIMEOUT_MILLIS) && urls.add(url);
}
}
if (!added) { throw new IOException("unable to resolve the remote ural of artifact " + artifact); }
}
return urls;
}
示例2: findVersion
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private String findVersion(List<DependencyNode> dependencies, String groupId, String artifactId)
{
for (DependencyNode child : dependencies)
{
Artifact childArtifact = child.getArtifact();
if (groupId.equals(childArtifact.getGroupId())
&& artifactId.equals(childArtifact.getArtifactId()))
{
return childArtifact.getBaseVersion();
}
else
{
String version = findVersion(child.getChildren(), groupId, artifactId);
if (version != null)
{
return version;
}
}
}
return null;
}
示例3: reportMissingDependencies
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private void reportMissingDependencies(PrintStream ps, ListMultimap<Artifact, DependencyNode> artifactNotFoundMap, boolean isBom) {
ps.print("--- ");
ps.print(isBom ? BomDependencyNotFoundException.class.getSimpleName() : DependencyNotFoundException.class.getSimpleName());
ps.print(" (found " + artifactNotFoundMap.keySet().size() + " missing dependencies)");
ps.println(" ---");
for (Artifact artifact : sortArtifacts(artifactNotFoundMap.keySet())) {
ps.println("miss: " + artifact);
List<DependencyNode> roots = sortDependencyNodes(artifactNotFoundMap.get(artifact));
for (DependencyNode root : roots) {
ps.println(" from: " + root.getArtifact());
String path = findPathToDependency(artifact, root);
String simplePath = root.getArtifact() + " > " + artifact;
if (isNotEmpty(path) && notEqual(path, simplePath)) {
ps.print(" path: ");
ps.print(path);
ps.println();
}
}
}
ps.println();
ps.flush();
}
示例4: processDependencyNode
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private void processDependencyNode(DependencyNode dependencyNode) {
Artifact artifact = dependencyNode.getArtifact();
if (!aetherPlugin.getVersionMap().containsKey(artifact.getGroupId()))
aetherPlugin.getVersionMap().put(artifact.getGroupId(), new HashMap<>());
aetherPlugin.getVersionMap().get(artifact.getGroupId()).put(artifact.getArtifactId(), artifact.getVersion());
for (DependencyNode node : dependencyNode.getChildren()) {
processDependencyNode(node);
}
}
示例5: processNode
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private ArtifactDescriptor processNode(DependencyNode node,
Map<DependencyNode, String> resolvedURIs) {
Artifact dependency = node.getArtifact();
DefaultArtifactDescriptor artifact = new DefaultArtifactDescriptor(dependency.getGroupId(),
dependency.getArtifactId(), dependency.getBaseVersion(),
ArtifactDescriptorFactory.toExtension(dependency.getExtension()),
ArtifactDescriptorFactory.toScope(node.getDependency().getScope()),
resolvedURIs.get(node));
node.getChildren().forEach(d -> artifact.addDependency(processNode(d, resolvedURIs)));
return artifact;
}
示例6: accept
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
@Override
public boolean accept(DependencyNode node, List<DependencyNode> parents) {
Artifact artifact = node.getArtifact();
String gav = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
+ artifact.getExtension() + ":" + artifact.getVersion();
Optional<String> exclusionMatch = exclusions.stream().filter(e -> matcher.match(e, gav))
.findAny();
return !exclusionMatch.isPresent();
}
示例7: shouldIncludeDependencyNode
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
@Override
boolean shouldIncludeDependencyNode(DependencyNode node, List<DependencyNode> parents) {
@Nullable Artifact artifact = node.getArtifact();
return artifact != null
&& (Bundles.ARTIFACT_TYPE.equals(artifact.getExtension()) || JAR_TYPE.equals(artifact.getExtension()))
&& !artifact.getGroupId().equals(BuildInformation.PROJECT_GROUP_ID);
}
示例8: createNode
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private DependencyNode createNode(DependencyNode n, Optional<String> extension, Optional<String> classifier) {
Artifact original = n.getArtifact();
Artifact withExtension =
new DefaultArtifact(original.getGroupId(),
original.getArtifactId(),
classifier.orElse(original.getClassifier()),
extension.orElse(original.getExtension()),
original.getVersion(),
original.getProperties(),
(File) null);
DefaultDependencyNode nodeWithClassifier = new DefaultDependencyNode(new Dependency(withExtension, "system"));
return nodeWithClassifier;
}
示例9: collectDeps
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
protected void collectDeps(DependencyNode n0, MavenProject p, int depth) {
getLog().debug("Collecting dependencies of "+n0+"/"+p+" at depth "+depth);
depNodesByIdCache.put(Coords.of(n0).normal(), n0);
if (n0.getDependency()!=null) {
if (n0.getDependency().isOptional() && (depth>1 || excludeRootOptionalDependencies)) {
getLog().warn("Optional dependency found in dependency tree: "+n0);
return;
}
if (!includeScope(n0.getDependency().getScope())) {
getLog().debug("Skipping "+n0.getDependency().getScope()+" dependency: "+n0);
return;
}
}
DefaultArtifact n0art = newMavenArtifact(n0.getArtifact());
if (p==null && n0.getArtifact()!=null) p = loadProject(n0art);
includedBaseArtifactsCoordsToProject.put(Coords.of(n0).baseArtifact(), Coords.of(n0).normal());
includedProjects.add(Coords.of(n0).normal());
includedArtifactsUnversionedToBaseArtifactCoords.put(Coords.of(n0).unversionedArtifact(), Coords.of(n0).baseArtifact());
includedProjectsUnversionedToVersioned.put(Coords.of(n0).unversioned(), Coords.of(n0).normal());
projectArtifacts.put(Coords.of(n0).normal(), n0art);
if (depth>=this.maxDepth) return;
for (DependencyNode n: n0.getChildren()) {
projectToDependencyGraphParent.put(Coords.of(n).normal(), Coords.of(n0).normal());
collectDeps(n, null, depth+1);
}
}
示例10: visitEnter
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
public boolean visitEnter(final DependencyNode node) {
final Artifact artifact = node.getArtifact();
final File artifact_file = artifact.getFile();
return files.add(artifact_file);
}
示例11: verify
import org.eclipse.aether.graph.DependencyNode; //导入方法依赖的package包/类
private boolean verify(DependencyNode node, RepositorySystemSession session,
RepositorySystem system, DependencyVerifier... verifiers) {
List<DependencyVerifier> vs = Arrays.asList(verifiers);
Artifact na = node.getArtifact();
boolean result = true;
if (vs.size() > 0) {
try {
raiseEvent(l -> l.starting(na.getGroupId(), na.getArtifactId(), na.getVersion()));
Artifact signatureArtifact = new DefaultArtifact(node.getArtifact().getGroupId(),
node.getArtifact().getArtifactId(), node.getArtifact().getClassifier(),
node.getArtifact().getExtension() + ".asc",
node.getArtifact().getVersion());
Artifact pomArtifact = new DefaultArtifact(node.getArtifact().getGroupId(),
node.getArtifact().getArtifactId(), node.getArtifact().getClassifier(),
"pom", node.getArtifact().getVersion());
Artifact pomSignatureArtifact = new DefaultArtifact(node.getArtifact().getGroupId(),
node.getArtifact().getArtifactId(), node.getArtifact().getClassifier(),
"pom.asc", node.getArtifact().getVersion());
List<ArtifactResult> resolveResult = system.resolveArtifacts(session, Arrays.asList(
new ArtifactRequest(node),
new ArtifactRequest(signatureArtifact, node.getRepositories(), null),
new ArtifactRequest(pomArtifact, node.getRepositories(), null),
new ArtifactRequest(pomSignatureArtifact, node.getRepositories(), null)));
Optional<ArtifactDescriptor> jar = findArtifact("jar", resolveResult);
Optional<ArtifactDescriptor> asc = findArtifact("jar.asc", resolveResult);
Optional<ArtifactDescriptor> pom = findArtifact("pom", resolveResult);
Optional<ArtifactDescriptor> pomAsc = findArtifact("pom.asc", resolveResult);
if (jar.isPresent() && asc.isPresent() && pom.isPresent() && pomAsc.isPresent()) {
result = !vs.stream()
.filter(v -> !v.verify(jar.get(), asc.get(), pom.get(), pomAsc.get()))
.findFirst().isPresent();
}
else {
result = false;
}
if (result) {
raiseEvent(
l -> l.succeeded(na.getGroupId(), na.getArtifactId(), na.getVersion()));
}
else {
raiseEvent(l -> l.failed(na.getGroupId(), na.getArtifactId(), na.getVersion(),
null));
}
}
catch (Exception e) {
result = false;
raiseEvent(l -> l.failed(na.getGroupId(), na.getArtifactId(), na.getVersion(), e));
throw new DependencyVerificationFailedException(
String.format("Verification of %s:%s (%s) failed",
node.getArtifact().getGroupId(), node.getArtifact().getArtifactId(),
node.getArtifact().getVersion()),
node.getArtifact().getGroupId(), node.getArtifact().getArtifactId(),
node.getArtifact().getVersion(), e);
}
}
return result;
}