0

我正在尝试使用eclipse-aether收集工件的依赖项,执行以下操作:

Artifact artifact = ...
DependencyVisitor dependencySaver = ...

ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
descriptorRequest.setArtifact(artifact);
descriptorRequest.setRepositories(Booter.newRepositories(system, session));
ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor(session, descriptorRequest);

CollectRequest collectRequest = new CollectRequest();
collectRequest.setRootArtifact(descriptorResult.getArtifact());
collectRequest.setDependencies(descriptorResult.getDependencies());
collectRequest.setManagedDependencies(descriptorResult.getManagedDependencies());
collectRequest.setRepositories(descriptorRequest.getRepositories());
CollectResult collectResult = system.collectDependencies(session, collectRequest);

collectResult.getRoot().accept(dependencySaver);

Apache存储库恰好包含具有依赖关系的工件,它们本身并不在存储库中。例如,org.apache.deltaspike:parent-code:pom:1.1.0依赖于org.jboss.arquillian:arquillian-bom:pom:1.0.2.Final,它不存在。

在这种情况下,Aether 拒绝报告结果:

org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.deltaspike:parent-code:pom:1.1.0
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:364)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
    at xxxxxxx.DependencyScanner$NodeScanner.run(DependencyScanner.java:128)
    at xxxxxxx.InsistentExecutor$Slave$ActionRunnable.run(InsistentExecutor.java:226)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact org.jboss.arquillian:arquillian-bom:pom:1.0.2.Final in apache (https://repository.apache.org/content/repositories/releases)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
    at org.apache.maven.model.building.DefaultModelBuilder.importDependencyManagement(DefaultModelBuilder.java:966)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:397)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:368)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:359)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:355)
    ... 9 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.jboss.arquillian:arquillian-bom:pom:1.0.2.Final in apache (https://repository.apache.org/content/repositories/releases)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
    ... 14 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.jboss.arquillian:arquillian-bom:pom:1.0.2.Final in apache (https://repository.apache.org/content/repositories/releases)
    at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 17 more

有没有办法让以太至少给出所有可访问依赖项的名称的部分结果?

4

1 回答 1

0

问题只是给定的工件:

org.jboss.arquillian:arquillian-bom:1.1.0

包含错误的版本。版本必须是:

org.jboss.arquillian:arquillian-bom:1.1.0.Final

您需要正确定义版本:

<dependency>
    <groupId>org.jboss.arquillian</groupId>
    <artifactId>arquillian-bom</artifactId>
    <version>1.0.0.Final</version>
</dependency>
于 2016-06-19T08:30:35.627 回答