本文整理汇总了Java中org.eclipse.aether.collection.CollectResult类的典型用法代码示例。如果您正苦于以下问题:Java CollectResult类的具体用法?Java CollectResult怎么用?Java CollectResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollectResult类属于org.eclipse.aether.collection包,在下文中一共展示了CollectResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collectDependencies
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Override
public CollectResult collectDependencies(RepositorySystemSession session, CollectRequest request) throws DependencyCollectionException {
DefaultRepositorySystemSession cloned = new DefaultRepositorySystemSession(session);
DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();
//need to reset the transformer to prevent the transformation to happen and to it below separately.
cloned.setDependencyGraphTransformer(null);
CollectResult res = super.collectDependencies(cloned, request);
CloningDependencyVisitor vis = new CloningDependencyVisitor();
res.getRoot().accept(vis);
//this part copied from DefaultDependencyCollector
try {
DefaultDependencyGraphTransformationContext context =
new DefaultDependencyGraphTransformationContext(session);
res.setRoot(transformer.transformGraph(res.getRoot(), context));
} catch (RepositoryException e) {
res.addException(e);
}
if (!res.getExceptions().isEmpty()) {
throw new DependencyCollectionException(res);
}
res.getRoot().setData("NB_TEST", vis.getRootNode());
return res;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:NbRepositorySystem.java
示例2: transitiveDependencies
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
public static Set<Artifact> transitiveDependencies(Artifact artifact) {
RepositorySystem system = newRepositorySystem();
RepositorySystemSession session = newRepositorySystemSession(system);
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, ""));
collectRequest.setRepositories(repositories());
CollectResult collectResult = null;
try {
collectResult = system.collectDependencies(session, collectRequest);
} catch (DependencyCollectionException e) {
throw new RuntimeException(e);
}
PreorderNodeListGenerator visitor = new PreorderNodeListGenerator();
collectResult.getRoot().accept(visitor);
return ImmutableSet.copyOf(
visitor.getNodes().stream()
.filter(d -> !d.getDependency().isOptional())
.map(DependencyNode::getArtifact)
.collect(Collectors.toList()));
}
开发者ID:pgr0ss,项目名称:bazel-deps,代码行数:27,代码来源:Maven.java
示例3: setUp
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
classLoaderResolver = new ClassLoaderResolver(log, repositorySystem, repositorySystemSession, Collections.<RemoteRepository>emptyList());
when(repositorySystem.collectDependencies(eq(repositorySystemSession), any(CollectRequest.class)))
.thenReturn(new CollectResult(new CollectRequest()).setRoot(root));
when(child.getDependency()).thenReturn(new Dependency(new DefaultArtifact(FOO,
BAR,
QUX,
BAZ,
FOO + BAR,
Collections.<String, String>emptyMap(),
new File(FOO + "/" + BAR)), QUX + BAZ));
when(root.accept(any(DependencyVisitor.class))).then(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
DependencyVisitor dependencyVisitor = invocationOnMock.getArgument(0);
dependencyVisitor.visitEnter(child);
dependencyVisitor.visitLeave(child);
return null;
}
});
}
开发者ID:raphw,项目名称:byte-buddy,代码行数:23,代码来源:ClassLoaderResolverTest.java
示例4: traverseAddonGraph
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
private DependencyNode traverseAddonGraph(String coords, RepositorySystem system, Settings settings,
DefaultRepositorySystemSession session)
{
session.setDependencyTraverser(new AddonDependencyTraverser(this.classifier));
session.setDependencySelector(new AddonDependencySelector(this.classifier));
Artifact queryArtifact = new DefaultArtifact(coords);
List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
CollectRequest collectRequest = new CollectRequest(new Dependency(queryArtifact, null), repositories);
CollectResult result;
try
{
result = system.collectDependencies(session, collectRequest);
}
catch (DependencyCollectionException e)
{
throw new RuntimeException(e);
}
return result.getRoot();
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:22,代码来源:MavenAddonDependencyResolver.java
示例5: resolveAsDependencyNode
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
private List<DependencyNode> resolveAsDependencyNode(final Artifact artifact) throws DependencyCollectionException, DependencyResolutionException {
final CollectResult collect_result = collectDependencies(artifact, repositories);
final DependencyNode root_dependency = collect_result.getRoot();
final DependencyRequest dep_request = new DependencyRequest();
final DependencyNodeCollector node_collector = new DependencyNodeCollector();
dep_request.setRoot(root_dependency);
REPOSITORY_SYSTEM.resolveDependencies(session, dep_request);
root_dependency.accept(node_collector);
return node_collector.nodes;
}
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:12,代码来源:MavenDependencyResolver.java
示例6: collectDependencies
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
private CollectResult collectDependencies(final Artifact artifact, final List<RemoteRepository> repositories) throws DependencyCollectionException {
final CollectResult collectResult;
final CollectRequest collectRequest = new CollectRequest();
final Dependency root_dependency = new Dependency(artifact, "");
collectRequest.setRoot(root_dependency);
collectRequest.setRepositories(repositories);
collectResult = REPOSITORY_SYSTEM.collectDependencies(session, collectRequest);
return collectResult;
}
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:11,代码来源:MavenDependencyResolver.java
示例7: testFetchPage
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Test
public void testFetchPage() throws DependencyResolutionException, DependencyCollectionException {
CollectResult collectResult = this.fetcher.fetchCollectResult(this.artifact, JavaScopes.COMPILE,
this.dependencySelector);
DependencyResult dependencyResult = this.fetcher.fetchDependencyResult(collectResult.getRoot(),
this.dependencySelector);
Page<Artifact, Artifact> page = this.fetcher.fetchPage(dependencyResult, false);
Assert.assertTrue(this.areEqual(page.getKey().get(), this.artifact));
Assert.assertNotNull(page.getKey().get().getFile());
Assert.assertEquals(page.getElements().size(), 48);
}
开发者ID:maenu,项目名称:kowalski,代码行数:12,代码来源:DependencyTest.java
示例8: resolveAll
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Override
public Set<ArtifactSpec> resolveAll(Set<ArtifactSpec> specs) throws Exception {
if (specs.isEmpty()) {
return specs;
}
final CollectRequest request = new CollectRequest();
request.setRepositories(this.remoteRepositories);
specs.forEach(spec -> request
.addDependency(new Dependency(new DefaultArtifact(spec.groupId(),
spec.artifactId(),
spec.classifier(),
spec.type(),
spec.version()),
"compile")));
CollectResult result = this.system.collectDependencies(this.session, request);
PreorderNodeListGenerator gen = new PreorderNodeListGenerator();
result.getRoot().accept(gen);
return gen.getNodes().stream()
.filter(node -> !"system".equals(node.getDependency().getScope()))
.map(node -> {
final Artifact artifact = node.getArtifact();
return new ArtifactSpec(node.getDependency().getScope(),
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion(),
artifact.getExtension(),
artifact.getClassifier(),
null);
})
.map(this::resolve)
.filter(x -> x != null)
.collect(Collectors.toSet());
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:41,代码来源:MavenArtifactResolvingHelper.java
示例9: setUp
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
when(repositorySystem.collectDependencies(Mockito.<RepositorySystemSession>any(), Mockito.<CollectRequest>any())).thenReturn(new CollectResult(new CollectRequest()).setRoot(root));
project = File.createTempFile(FOO, TEMP);
assertThat(project.delete(), is(true));
assertThat(project.mkdir(), is(true));
}
开发者ID:raphw,项目名称:byte-buddy,代码行数:8,代码来源:ByteBuddyMojoTest.java
示例10: execute
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Override
public void execute(DependencyResolveDetails dependencyResolveDetails) {
String group = dependencyResolveDetails.getTarget().getGroup();
String name = dependencyResolveDetails.getTarget().getName();
if (aetherPlugin.getVersionMap().containsKey(group) && aetherPlugin.getVersionMap().get(group).containsKey(name)) {
if (dependencyResolveDetails.getRequested().getVersion().equals(dependencyResolveDetails.getTarget().getVersion())) {
dependencyResolveDetails.useVersion(aetherPlugin.getVersionMap().get(group).get(name));
}
} else {
RepositorySystem system = setupRepositorySystem();
RepositorySystemSession session = setupSession(project, system);
List<RemoteRepository> remoteRepositories = new ArrayList<>();
for (ArtifactRepository artifactRepository : project.getRepositories()) {
if (artifactRepository instanceof MavenArtifactRepository) {
MavenArtifactRepository mavenArtifactRepository = (MavenArtifactRepository) artifactRepository;
remoteRepositories.add(new RemoteRepository.Builder(mavenArtifactRepository.getName(), "default", mavenArtifactRepository.getUrl().toString()).build());
}
}
Artifact artifact = new DefaultArtifact(dependencyResolveDetails.getTarget().getGroup()
+ ":" + dependencyResolveDetails.getTarget().getName()
+ ":" + dependencyResolveDetails.getTarget().getVersion());
CollectRequest collectRequest = new CollectRequest();
String scope;
if (configuration.getName().contains("test")) {
scope = JavaScopes.TEST;
} else if (configuration.getName().contains("runtime")) {
scope = JavaScopes.RUNTIME;
} else if (configuration.getName().equals("providedCompile")
|| configuration.getName().equals("compileOnly")) {
scope = JavaScopes.PROVIDED;
} else
scope = JavaScopes.COMPILE;
collectRequest.setRoot(new Dependency(artifact, scope));
collectRequest.setRepositories(remoteRepositories);
try {
CollectResult collectResult = system.collectDependencies(session, collectRequest);
processDependencyNode(collectResult.getRoot());
} catch (DependencyCollectionException e) {
e.printStackTrace();
}
}
}
开发者ID:SetoKaiba,项目名称:aether-gradle-plugin,代码行数:45,代码来源:VersionResolverDependencyResolveDetails.java
示例11: getSource
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
private void getSource(String message, CollectResult result) {
if (message.startsWith("Failed to collect dependencies at ")) {
StringBuilder sb = new StringBuilder();
sb.append("Failed to resolve or download dependencies:");
message = message.substring("Failed to collect dependencies at ".length());
String[] artifacts = message.split(" -> ");
if (artifacts != null && artifacts.length > 0) {
String indent = " ";
sb.append("\n").append(indent).append(artifacts[0]);
for (int i = 1; i < artifacts.length; i++) {
sb.append("\n").append(indent);
if (i + 1 == artifacts.length) {
sb.append(LAST_TREE_NODE);
sb.append(artifacts[i]);
sb.append(" ").append(REDIVID).append(" missing or unable to download");
}
else {
sb.append(LAST_TREE_NODE_WITH_CHILDREN);
sb.append(artifacts[i]);
}
indent = indent + " ";
}
this.type = ErrorType.DEPENDENCY_ERROR;
this.detailMessage = sb.toString();
}
}
else if (message.startsWith("Failed to read artifact descriptor for ")) {
CollectRequest request = result.getRequest();
Artifact artifact = null;
if (request.getRoot() != null) {
artifact = request.getRoot().getArtifact();
}
if (request.getRootArtifact() != null) {
artifact = request.getRootArtifact();
}
if (artifact != null) {
this.type = ErrorType.ROOT_ARTIFACT_ERROR;
this.detailMessage = String.format("Could not find requested archive %s:%s:%s:%s.",
artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
artifact.getVersion());
}
}
}
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:46,代码来源:DependencyCollectionException.java
示例12: testCollectionFailure
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Test(expected = MojoExecutionException.class)
public void testCollectionFailure() throws Exception {
when(repositorySystem.collectDependencies(eq(repositorySystemSession), any(CollectRequest.class)))
.thenThrow(new DependencyCollectionException(new CollectResult(new CollectRequest())));
classLoaderResolver.resolve(new MavenCoordinate(FOO, BAR, QUX));
}
开发者ID:raphw,项目名称:byte-buddy,代码行数:7,代码来源:ClassLoaderResolverTest.java
示例13: resolveAPIVersion
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
private Response<String> resolveAPIVersion(AddonId addonId, RepositorySystem system, Settings settings,
DefaultRepositorySystemSession session)
{
List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
String mavenCoords = toMavenCoords(addonId);
Artifact queryArtifact = new DefaultArtifact(mavenCoords);
session.setDependencyTraverser(new AddonDependencyTraverser(classifier));
session.setDependencySelector(new DependencySelector()
{
@Override
public boolean selectDependency(Dependency dependency)
{
Artifact artifact = dependency.getArtifact();
if (isAddon(artifact))
{
return true;
}
return isFurnaceAPI(artifact);
}
@Override
public DependencySelector deriveChildSelector(DependencyCollectionContext context)
{
return this;
}
});
CollectRequest request = new CollectRequest(new Dependency(queryArtifact, null), repositories);
CollectResult result;
try
{
result = system.collectDependencies(session, request);
}
catch (DependencyCollectionException e)
{
throw new RuntimeException(e);
}
List<Exception> exceptions = result.getExceptions();
String apiVersion = findVersion(result.getRoot().getChildren(), FURNACE_API_GROUP_ID, FURNACE_API_ARTIFACT_ID);
return new MavenResponseBuilder<String>(apiVersion).setExceptions(exceptions);
}
开发者ID:forge,项目名称:furnace,代码行数:43,代码来源:MavenAddonDependencyResolver.java
示例14: resolveAPIVersion
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
@Override
public Response<String> resolveAPIVersion(AddonId addonId)
{
RepositorySystem system = container.getRepositorySystem();
Settings settings = getSettings();
DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
String mavenCoords = toMavenCoords(addonId);
Artifact queryArtifact = new DefaultArtifact(mavenCoords);
session.setDependencyTraverser(new AddonDependencyTraverser(classifier));
session.setDependencySelector(new DependencySelector()
{
@Override
public boolean selectDependency(Dependency dependency)
{
Artifact artifact = dependency.getArtifact();
if (classifier.equals(artifact.getClassifier()))
{
return true;
}
return (FURNACE_API_GROUP_ID.equals(artifact.getGroupId()) && FURNACE_API_ARTIFACT_ID.equals(artifact
.getArtifactId()));
}
@Override
public DependencySelector deriveChildSelector(DependencyCollectionContext context)
{
return this;
}
});
CollectRequest request = new CollectRequest(new Dependency(queryArtifact, null), repositories);
CollectResult result;
try
{
result = system.collectDependencies(session, request);
}
catch (DependencyCollectionException e)
{
throw new RuntimeException(e);
}
List<Exception> exceptions = result.getExceptions();
String apiVersion = findVersion(result.getRoot().getChildren(), FURNACE_API_GROUP_ID, FURNACE_API_ARTIFACT_ID);
return new MavenResponseBuilder<String>(apiVersion).setExceptions(exceptions);
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:47,代码来源:MavenAddonDependencyResolver.java
示例15: fetchCollectResult
import org.eclipse.aether.collection.CollectResult; //导入依赖的package包/类
/**
*
* @param artifact
* @param scope
* {@link org.eclipse.aether.util.artifact.JavaScopes}
* @param dependencySelector
* @return
* @throws DependencyCollectionException
*/
public CollectResult fetchCollectResult(Artifact artifact, String scope, DependencySelector dependencySelector)
throws DependencyCollectionException {
RepositorySystem repositorySystem = this.maven.getRepositorySystem();
CollectRequest collectRequest = this.maven.newCollectRequest(artifact, scope);
DefaultRepositorySystemSession repositorySystemSession = this.maven.newRepositorySystemSession();
repositorySystemSession.setDependencySelector(dependencySelector);
return repositorySystem.collectDependencies(repositorySystemSession, collectRequest);
}
开发者ID:maenu,项目名称:kowalski,代码行数:18,代码来源:Dependency.java
注:本文中的org.eclipse.aether.collection.CollectResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论