• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DependencyFilterUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.aether.util.filter.DependencyFilterUtils的典型用法代码示例。如果您正苦于以下问题:Java DependencyFilterUtils类的具体用法?Java DependencyFilterUtils怎么用?Java DependencyFilterUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DependencyFilterUtils类属于org.eclipse.aether.util.filter包,在下文中一共展示了DependencyFilterUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveArtifacts

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private Stream<? extends Artifact> resolveArtifacts(String coordinator) {
    log.debug("resolving {}", coordinator);
    try {
        // build resolve filters
        CollectRequest collectRequest = new CollectRequest();
        collectRequest.setRoot(new Dependency(new DefaultArtifact(coordinator), JavaScopes.COMPILE));
        DependencyRequest dependencyRequest = new DependencyRequest(
                collectRequest,
                DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE, JavaScopes.RUNTIME)
        );
        // resolve
        final List<Artifact> artifacts = teslaAether.resolveArtifacts(dependencyRequest);
        if (CollectionUtils.isEmpty(artifacts)) {
            throw new DependencyResolveException(String.format("cannot resolve %s", coordinator));
        }
        return artifacts.stream();
    } catch (DependencyResolutionException e) {
        final String message = String.format("cannot resolve %s : %s", coordinator, e.getLocalizedMessage());
        throw new DependencyResolveException(message, e);
    }
}
 
开发者ID:dshell-io,项目名称:dshell,代码行数:22,代码来源:DefaultDependencyResolver.java


示例2: resolveDependencies

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private List<Artifact> resolveDependencies(final Artifact artifact) throws DependencyResolutionException {
    List<Artifact> result = new ArrayList<Artifact>();

    RepositorySystem system = newRepositorySystem();
    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setRoot(new org.eclipse.aether.graph.Dependency(artifact, JavaScopes.COMPILE));
    List<ArtifactResult> dependenciesTree = system.resolveDependencies(
            session,
            new DependencyRequest(collectRequest, DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE))
    ).getArtifactResults();
    for (final ArtifactResult res : dependenciesTree) {
        result.add(res.getArtifact());
    }

    return result;
}
 
开发者ID:smoope,项目名称:j2objc-maven-plugin,代码行数:17,代码来源:J2ObjCConverterMojo.java


示例3: getDependencies

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
public List<Artifact> getDependencies(String groupId, String artifactId, String extension, String version) throws Exception {
  Artifact artifact = new DefaultArtifact(groupId, artifactId, extension, version);
  CollectRequest collectRequest = new CollectRequest();
  collectRequest.setRoot(new Dependency( artifact, ""));
  collectRequest.setRepositories(Collections.emptyList());
  DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE));
  DependencyResult dependencyResult = system.resolveDependencies(session, dependencyRequest);
  List<Artifact> dependencies = new ArrayList<>();
  for (ArtifactResult artifactResult : dependencyResult.getArtifactResults()) {
    if (!artifactResult.isResolved()) {
      throw new Exception("Could not resolve artifact " + artifactResult.getRequest().getArtifact());
    }
    dependencies.add(artifactResult.getArtifact());
  }
  return dependencies;
}
 
开发者ID:vert-x3,项目名称:vertx-maven-service-factory,代码行数:17,代码来源:AetherHelper.java


示例4: resolveArtifactsAndDependencies

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
public List<File> resolveArtifactsAndDependencies(List<Artifact> artifacts) throws ArtifactResolutionException, DependencyResolutionException {
    List<Dependency> dependencies = new ArrayList<Dependency>();

    for (Artifact artifact : artifacts) {
        dependencies.add(new Dependency(artifact, JavaScopes.RUNTIME));
    }
    
    CollectRequest collectRequest = new CollectRequest((Dependency)null, dependencies, repositories);
    DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.RUNTIME);
    DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);
    DependencyResult result = system.resolveDependencies(session, dependencyRequest);
    
    List<File> files = new ArrayList<File>();
    
    for (ArtifactResult artifactResult : result.getArtifactResults()) {
        files.add(artifactResult.getArtifact().getFile());
    }
    
    return files;
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:21,代码来源:DependencyResolver.java


示例5: getRunTimeTransitiveDeps

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private ImmutableMap<String, Artifact> getRunTimeTransitiveDeps(Iterable<Dependency> mavenCoords)
    throws RepositoryException {

  CollectRequest collectRequest = new CollectRequest();
  collectRequest.setRequestContext(JavaScopes.RUNTIME);
  collectRequest.setRepositories(repos);

  for (Dependency dep : mavenCoords) {
    collectRequest.addDependency(dep);
  }

  DependencyFilter filter = DependencyFilterUtils.classpathFilter(JavaScopes.RUNTIME);
  DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, filter);

  DependencyResult dependencyResult = repoSys.resolveDependencies(session, dependencyRequest);

  ImmutableSortedMap.Builder<String, Artifact> knownDeps = ImmutableSortedMap.naturalOrder();
  for (ArtifactResult artifactResult : dependencyResult.getArtifactResults()) {
    Artifact node = artifactResult.getArtifact();
    knownDeps.put(buildKey(node), node);
  }
  return knownDeps.build();
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:Resolver.java


示例6: downloadDependencyTree

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
/**
 * Resolves and downloads an artifact with its dependencies.
 * 
 * @param artifact
 *          artifact to resolve
 * @param javadoc
 *          <code>true</code> if javadoc attachment should be retrieved too
 * @param sources
 *          <code>true</code> if sources attachment should be retrieved too
 * @throws DependencyCollectionException
 *           if the dependency graph could not be properly assembled
 * @throws DependencyResolutionException
 *           if a dependency is not resolvable
 */
public void downloadDependencyTree(DefaultArtifact artifact, boolean javadoc, boolean sources)
    throws DependencyCollectionException, DependencyResolutionException {
  log.info("Resolving: {} with these dependencies ...", artifact.toString());

  Dependency dependency = new Dependency(artifact, JavaScopes.COMPILE);

  DependencyNode jarNode = repoSystemHelper.collectDependencies(dependency);

  DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.TEST);
  jarNode.accept(new TreeDependencyVisitor(new FilteringDependencyVisitor(new DependencyGraphPrinter(), classpathFilter)));

  DependencyRequest dependencyRequest = new DependencyRequest(jarNode, classpathFilter);
  DependencyResult dependencyResult = repoSystemHelper.resolveDependencies(dependencyRequest);

  if (javadoc) {
    downloadAttachments(dependencyResult, "javadoc");
  }

  if (sources) {
    downloadAttachments(dependencyResult, "sources");
  }
}
 
开发者ID:Gemba,项目名称:mvn-dd,代码行数:37,代码来源:DependencyResolver.java


示例7: validateBomDependency

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private void validateBomDependency(ValidatorContext ctx, Model bom, Dependency bomDependency, Dependency dependency) {
    CollectRequest collectRequest = new CollectRequest(
            bomDependency,
            Collections.singletonList(dependency),
            ctx.getRemoteRepositories());

    DependencyRequest dependencyRequest = new DependencyRequest(
            collectRequest,
            DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE));

    try {
        repositorySystem.resolveDependencies(repositorySystemSession, dependencyRequest);
    } catch (DependencyResolutionException e) {
        ArtifactResolutionException are = findCause(e, ArtifactResolutionException.class);
        if( are == null ) {
            ctx.addError(this, bom.getPomFile(), e);
        } else {
            DependencyNode dependencyNode = e.getResult().getRoot();
            Artifact validatedArtifact = new DefaultArtifact(bom.getGroupId(), bom.getArtifactId(), bom.getPackaging(), bom.getVersion());
            for (Artifact missingArtifact : Utils.collectMissingArtifacts(are)) {
                ctx.addError(this, bom.getPomFile(), new BomDependencyNotFoundException(e, missingArtifact, validatedArtifact, dependencyNode));                
            }
        }
    }
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:26,代码来源:BomDependencyNotFoundValidator.java


示例8: load

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
@Override
public void load(Dependency dependency) throws DependencyResolutionException, DependencyProvisionException {
    List<RemoteRepository> remoteRepositories = remoteRepositoriesSupplier.get();
    CollectRequest collectRequest = new CollectRequest(dependency, remoteRepositories);
    DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE));

    DependencyResult dependencyResult = repositorySystem.resolveDependencies(repositorySystemSession, dependencyRequest);
    for (ArtifactResult artifactResult : dependencyResult.getArtifactResults())
        inject(artifactResult);
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:11,代码来源:ClassLoaderLibraryResolver.java


示例9: prepareDependencies

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
/**
 * Prepare an import with dependencies
 * <p>
 * This method does resolve even transient dependencies and also adds the
 * sources if requested
 * </p>
 */
public static AetherResult prepareDependencies ( final Path tmpDir, final ImportConfiguration cfg ) throws RepositoryException
{
    Objects.requireNonNull ( tmpDir );
    Objects.requireNonNull ( cfg );

    final RepositoryContext ctx = new RepositoryContext ( tmpDir, cfg.getRepositoryUrl (), cfg.isAllOptional () );

    // add all coordinates

    final CollectRequest cr = new CollectRequest ();
    cr.setRepositories ( ctx.getRepositories () );
    for ( final MavenCoordinates coords : cfg.getCoordinates () )
    {
        final Dependency dep = new Dependency ( new DefaultArtifact ( coords.toString () ), COMPILE );
        cr.addDependency ( dep );
    }

    final DependencyFilter filter = DependencyFilterUtils.classpathFilter ( COMPILE );
    final DependencyRequest deps = new DependencyRequest ( cr, filter );

    // resolve

    final DependencyResult dr = ctx.getSystem ().resolveDependencies ( ctx.getSession (), deps );
    final List<ArtifactResult> arts = dr.getArtifactResults ();

    if ( !cfg.isIncludeSources () )
    {
        // we are already done here
        return asResult ( arts, cfg, of ( dr ) );
    }

    // resolve sources

    final List<ArtifactRequest> requests = extendRequests ( arts.stream ().map ( ArtifactResult::getRequest ), ctx, cfg );

    return asResult ( resolve ( ctx, requests ), cfg, of ( dr ) );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:45,代码来源:AetherImporter.java


示例10: buildDependencyRequest

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private static DependencyRequest buildDependencyRequest(List<RemoteRepository> repositories, String identifier, String scope)
{
    Artifact artifact = new DefaultArtifact(identifier);

    DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter(scope);

    CollectRequest collectRequest = new CollectRequest();
    collectRequest.setRoot(new Dependency(artifact, scope));
    collectRequest.setRepositories(repositories);

    return new DependencyRequest(collectRequest, classpathFlter);
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:13,代码来源:RemotePluginLoader.java


示例11: getArtifactsFiles

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private Collection<File> getArtifactsFiles(List<Dependency> dependencies) {
	String reposFileName = config.getString(WebjarModuleConfig.REPOS_FILE, WebjarModuleConfig.REPOS_FILE_DEFAULT);

	RepositoryConfig repositoryConfig = new RepositoryConfig(container.logger(), reposFileName);

	RepositorySystem system = createRepositorySystem();
	RepositorySystemSession session = createRepositorySystemSession(system, repositoryConfig.getLocalRepository());

	DependencyFilter classpathFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);

	CollectRequest collectRequest = new CollectRequest(dependencies, null, repositoryConfig.getRemoteRepositories());
	DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFilter);

	try {
		List<ArtifactResult> artifactResults = system.resolveDependencies(session, dependencyRequest)
				.getArtifactResults();

		Collection<File> artifactsFiles = new HashSet<>();
		for (ArtifactResult artifactResult : artifactResults) {
			checkArtifactResultStatus(artifactResult);
			artifactsFiles.add(artifactResult.getArtifact().getFile());
		}
		return artifactsFiles;
	} catch (DependencyResolutionException e) {
		throw new WebjarModuleException("Failed to resolve dependencies", e);
	}
}
 
开发者ID:ylemoigne,项目名称:vertx-mod-webjar,代码行数:28,代码来源:WebjarPullerVerticle.java


示例12: createDependencyRequest

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
DependencyRequest createDependencyRequest(CollectRequest collectRequest) {
  DependencyFilter compileFilter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
  return createDependencyRequest(collectRequest, compileFilter);
}
 
开发者ID:bazelbuild,项目名称:migration-tooling,代码行数:5,代码来源:Aether.java


示例13: listTransitiveDependencies

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
public static Set<DependencyWrapper> listTransitiveDependencies(Set<DependencyWrapper> dependencySet) {
    Set<DependencyWrapper> dependencies = Sets.newHashSet();

    for (DependencyWrapper dependency : dependencySet) {
        RepositorySystem system = Booter.newRepositorySystem();

        RepositorySystemSession session = Booter.newRepositorySystemSession(system);

        Artifact artifact = new DefaultArtifact(
                String.format("%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion()));

        DependencyFilter classpathFlter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);

        CollectRequest collectRequest = new CollectRequest();
        collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));
        collectRequest.setRepositories(Booter.newRepositories(system, session));

        DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, classpathFlter);

        List<ArtifactResult> artifactResults = null;
        try {
            artifactResults = system.resolveDependencies(session, dependencyRequest).getArtifactResults();
        } catch (DependencyResolutionException e) {
            continue;
        }

        for (ArtifactResult artifactResult : artifactResults) {

            if (artifactResult.getRepository() == null) {
                continue;
            }

            Artifact artifact1 = artifactResult.getArtifact();

            org.apache.maven.model.Dependency dependency1 = new org.apache.maven.model.Dependency();
            dependency1.setArtifactId(artifact1.getArtifactId());
            dependency1.setGroupId(artifact1.getGroupId());
            dependency1.setVersion(artifact1.getVersion());
            dependency1.setClassifier(artifact1.getClassifier());
            if (!MavenUtils.isDependencyResolvable(dependency1)) {
                continue;
            }

            dependencies
                    .add(new DependencyWrapper(artifact1.getGroupId(), artifact1.getArtifactId(), artifact1.getVersion()));
        }
    }

    return dependencies;
}
 
开发者ID:AGETO,项目名称:hybris-maven-plugin,代码行数:51,代码来源:DependencyResolver.java


示例14: getDependencyRequest

import org.eclipse.aether.util.filter.DependencyFilterUtils; //导入依赖的package包/类
private DependencyRequest getDependencyRequest(CollectRequest collectRequest) {
	DependencyRequest dependencyRequest = new DependencyRequest(collectRequest,
			DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE,
					JavaScopes.RUNTIME));
	return dependencyRequest;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:AetherGrapeEngine.java



注:本文中的org.eclipse.aether.util.filter.DependencyFilterUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sound类代码示例发布时间:2022-05-21
下一篇:
Java EnsembleProvider类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap