当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactDescriptorRequest类代码示例

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


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

示例1: assertDependencyUpdated

import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入依赖的package包/类
private void assertDependencyUpdated(final Artifact artifact, final String targetProject,
		final String expectedVersion, final String expectedBuildNumber) throws Exception {
	final RepositorySystemSession session = newRepositorySystemSession();
	final ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
	descriptorRequest.setArtifact(artifact);

	final ArtifactDescriptorResult descriptorResult = system.readArtifactDescriptor(session, descriptorRequest);

	Dependency targetDependency = null;
	for (final Dependency dep : descriptorResult.getDependencies()) {
		if (targetProject.equals(dep.getArtifact().getArtifactId())) {
			targetDependency = dep;
			break;
		}
	}

	assertNotNull(format("No dependency found with artifact-id %s", targetProject), targetDependency);
	assertEquals(format("%s%s", expectedVersion, expectedBuildNumber), targetDependency.getArtifact().getVersion());
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:20,代码来源:NestedModulesBaseTest.java

示例2: resolveDependencies

import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入依赖的package包/类
private Map<Artifact, Dependency> resolveDependencies(BomImport bom) throws Exception {
    org.eclipse.aether.artifact.Artifact artifact = new org.eclipse.aether.artifact.DefaultArtifact(bom.getGroupId(), bom.getArtifactId(), "pom", bom.getVersion());

    List<RemoteRepository> repositories = remoteRepositories;
    if (bom.getRepository() != null) {
        // Include the additional repository into the copy
        repositories = new LinkedList<RemoteRepository>(repositories);
        RemoteRepository repo = new RemoteRepository.Builder(bom.getArtifactId() + "-repository", "default", bom.getRepository()).build();
        repositories.add(0, repo);
    }

    ArtifactRequest artifactRequest = new ArtifactRequest(artifact, repositories, null);
    system.resolveArtifact(session, artifactRequest); // To get an error when the artifact does not exist

    ArtifactDescriptorRequest req = new ArtifactDescriptorRequest(artifact, repositories, null);
    ArtifactDescriptorResult res = system.readArtifactDescriptor(session, req);

    Map<Artifact, Dependency> mavenDependencies = new LinkedHashMap<Artifact, Dependency>();
    if (res.getManagedDependencies() != null) {
        for (org.eclipse.aether.graph.Dependency dep : res.getManagedDependencies()) {
            mavenDependencies.put(toMavenArtifact(dep), toMavenDependency(dep));
        }
    }

    return mavenDependencies;
}
 
开发者ID:sundrio,项目名称:sundrio,代码行数:27,代码来源:ExternalBomResolver.java

示例3: 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);
    }
}
 
开发者ID:msoute,项目名称:vertx-deploy-tools,代码行数:17,代码来源:DeployUtils.java

示例4: getDirectDependencies

import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入依赖的package包/类
private ImmutableSet<ArtifactCoordinates> getDirectDependencies(Artifact artifact) throws RepositoryException {
	ArtifactDescriptorRequest descriptorRequest =
			new ArtifactDescriptorRequest(artifact, singletonList(mavenCentral), null);
	return repositorySystem
			.readArtifactDescriptor(repositorySystemSession, descriptorRequest)
			.getDependencies().stream()
			.filter(this::noTestDependency)
			.map(Dependency::getArtifact)
			.map(ArtifactCoordinates::from)
			.collect(toImmutableSet());
}
 
开发者ID:CodeFX-org,项目名称:jdeps-wall-of-shame,代码行数:12,代码来源:MavenCentral.java

示例5: getAllDependencies

import org.eclipse.aether.resolution.ArtifactDescriptorRequest; //导入依赖的package包/类
public Set<Dependency> getAllDependencies(Artifact artifact) throws ArtifactDescriptorException {
    ArtifactDescriptorRequest request = new ArtifactDescriptorRequest(artifact, repositories, null);
    ArtifactDescriptorResult result = system.readArtifactDescriptor(session, request);

    Set<Dependency> dependencies = new HashSet<>(result.getManagedDependencies());
    dependencies.addAll(result.getDependencies());

    return dependencies;
}
 
开发者ID:flipkart-incubator,项目名称:Poseidon,代码行数:10,代码来源:Cadfael.java

示例6: 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;
}
 
开发者ID:MovingBlocks,项目名称:ModuleManager,代码行数:16,代码来源:RepositoryConnector.java

示例7: 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;
}
 
开发者ID:forge,项目名称:furnace,代码行数:15,代码来源:MavenAddonDependencyResolver.java

示例8: 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();
}
 
开发者ID:facebook,项目名称:buck,代码行数:10,代码来源:Resolver.java


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