本文整理汇总了Java中org.sonatype.aether.collection.DependencyCollectionException类的典型用法代码示例。如果您正苦于以下问题:Java DependencyCollectionException类的具体用法?Java DependencyCollectionException怎么用?Java DependencyCollectionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DependencyCollectionException类属于org.sonatype.aether.collection包,在下文中一共展示了DependencyCollectionException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import org.sonatype.aether.collection.DependencyCollectionException; //导入依赖的package包/类
private void resolve( ResolveRequest resolveRequest )
{
RepositorySystem system = newRepositorySystem();
RepositorySystemSession session = newRepositorySystemSession( system, resolveRequest.localRepoDir );
org.sonatype.aether.artifact.Artifact artifact = new DefaultArtifact(
resolveRequest.groupId + ":" + resolveRequest.artifactId + ":" + resolveRequest.version );
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot( new Dependency( artifact, "" ) );
// add remote repositories
for ( RemoteRepository remoteRepository : resolveRequest.remoteRepositories )
{
collectRequest.addRepository(
new org.sonatype.aether.repository.RemoteRepository( remoteRepository.getId(), "default",
remoteRepository.getUrl() ) );
}
collectRequest.setRequestContext( "project" );
//collectRequest.addRepository( repo );
try
{
CollectResult collectResult = system.collectDependencies( session, collectRequest );
collectResult.getRoot().accept( resolveRequest.dependencyVisitor );
log.debug( "test" );
}
catch ( DependencyCollectionException e )
{
log.error( e.getMessage(), e );
}
}
示例2: collectDependenciesIntoArtifacts
import org.sonatype.aether.collection.DependencyCollectionException; //导入依赖的package包/类
private List<Artifact> collectDependenciesIntoArtifacts(CollectRequest collectRequest)
throws PlexusContainerException, ComponentLookupException, DependencyCollectionException, ArtifactResolutionException, DependencyResolutionException {
RepositorySystem repositorySystem = newRepositorySystem();
RepositorySystemSession session = newSession(repositorySystem);
DependencyNode node = repositorySystem.collectDependencies(session, collectRequest).getRoot();
DependencyFilter filter = new ScopeDependencyFilter();
DependencyRequest request = new DependencyRequest(node, filter);
repositorySystem.resolveDependencies(session, request);
// PathRecordingDependencyVisitor will give every path, which may help in building a hierarchical class loader
PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
node.accept(nlg);
return nlg.getArtifacts(false);
}
示例3: collectDependencies
import org.sonatype.aether.collection.DependencyCollectionException; //导入依赖的package包/类
/**
* Collects the transitive dependencies of an artifact and builds a dependency graph. Note that this operation is
* only concerned about determining the coordinates of the transitive dependencies. To also resolve the actual
* artifact files, use {@link #resolveDependencies(DependencyRequest)}.
*
* @param request The collection request, must not be {@code null}
* @return The collection result, never {@code null}.
* @throws org.sonatype.aether.collection.DependencyCollectionException If the dependency tree could not be built.
* @see RepositorySystemSession#getDependencyTraverser()
* @see RepositorySystemSession#getDependencyManager()
* @see RepositorySystemSession#getDependencySelector()
* @see RepositorySystemSession#getDependencyGraphTransformer()
*/
public CollectResult collectDependencies( CollectRequest request ) throws DependencyCollectionException {
return repository.collectDependencies(session, request);
}