本文整理汇总了Java中org.eclipse.aether.resolution.ArtifactDescriptorRequest.setRepositories方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactDescriptorRequest.setRepositories方法的具体用法?Java ArtifactDescriptorRequest.setRepositories怎么用?Java ArtifactDescriptorRequest.setRepositories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.aether.resolution.ArtifactDescriptorRequest
的用法示例。
在下文中一共展示了ArtifactDescriptorRequest.setRepositories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasTransitiveSnapshots
import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入方法依赖的package包/类
private boolean hasTransitiveSnapshots(Dependency dependency) throws MojoFailureException {
ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
descriptorRequest.setArtifact(
new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getType(), dependency.getVersion()));
descriptorRequest.setRepositories(remoteRepos);
try {
ArtifactDescriptorResult result = repoSystem.readArtifactDescriptor(repoSession, descriptorRequest);
Optional<org.eclipse.aether.graph.Dependency> snapshotDependency = result.getDependencies().stream()
.filter(d -> d.getArtifact().isSnapshot())
.findFirst();
return snapshotDependency.isPresent();
} catch (ArtifactDescriptorException e) {
throw new MojoFailureException(e.getMessage(), e);
}
}
示例2: getDependencies
import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入方法依赖的package包/类
public Collection<String> getDependencies(String moduleId, String version) throws ArtifactDescriptorException {
Artifact artifact = new DefaultArtifact(groupId, moduleId, "jar", version);
ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
descriptorRequest.setArtifact(artifact);
descriptorRequest.setRepositories(repos);
ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor(session, descriptorRequest);
List<String> deps = Lists.newArrayList();
for (Dependency dep : descriptorResult.getDependencies()) {
deps.add(dep.getArtifact().getArtifactId());
}
return deps;
}
示例3: readArtifactDescriptor
import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入方法依赖的package包/类
private ArtifactDescriptorResult readArtifactDescriptor(AddonId addonId) throws ArtifactDescriptorException
{
String coords = toMavenCoords(addonId);
RepositorySystem system = container.getRepositorySystem();
Settings settings = getSettings();
DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
request.setArtifact(new DefaultArtifact(coords));
request.setRepositories(repositories);
ArtifactDescriptorResult result = system.readArtifactDescriptor(session, request);
return result;
}
示例4: getDependenciesOf
import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入方法依赖的package包/类
private List<Dependency> getDependenciesOf(Artifact dep) throws ArtifactDescriptorException {
ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
descriptorRequest.setArtifact(dep);
descriptorRequest.setRepositories(repos);
descriptorRequest.setRequestContext(JavaScopes.RUNTIME);
ArtifactDescriptorResult result = repoSys.readArtifactDescriptor(session, descriptorRequest);
return result.getDependencies();
}