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


Java VersionRangeRequest.setRepositories方法代码示例

本文整理汇总了Java中org.eclipse.aether.resolution.VersionRangeRequest.setRepositories方法的典型用法代码示例。如果您正苦于以下问题:Java VersionRangeRequest.setRepositories方法的具体用法?Java VersionRangeRequest.setRepositories怎么用?Java VersionRangeRequest.setRepositories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.aether.resolution.VersionRangeRequest的用法示例。


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

示例1: getLatestVersion

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
private String getLatestVersion(String groupId, String artifactId, String range,
        RepositorySystemSession session, List<RemoteRepository> remotes)
        throws VersionRangeResolutionException {
    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact(
            new DefaultArtifact(String.format("%s:%s:%s", groupId, artifactId, range)));
    rangeRequest.setRepositories(remotes);

    VersionRangeResult rangeResult = repoSystem.resolveVersionRange(session, rangeRequest);
    if (rangeResult.getHighestVersion() != null) {
        return rangeResult.getHighestVersion().toString();
    }
    else {
        throw new com.atomist.rug.resolver.maven.DependencyCollectionException(String
                .format("Unable to find a version of archive %s:%s.", groupId, artifactId),
                properties.repositories());
    }
}
 
开发者ID:atomist-attic,项目名称:rug-resolver,代码行数:19,代码来源:MavenBasedDependencyResolver.java

示例2: findAvailableVersions

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
public Collection<String> findAvailableVersions(String moduleId) {

        Artifact artifact = new DefaultArtifact(groupId, moduleId, "jar", "[0,)");

        VersionRangeRequest rangeRequest = new VersionRangeRequest();
        rangeRequest.setArtifact(artifact);
        rangeRequest.setRepositories(repos);

        VersionRangeResult rangeResult;
        try {
            rangeResult = system.resolveVersionRange(session, rangeRequest);
        } catch (VersionRangeResolutionException e) {
            logger.error("The requested range could not be parsed", e);
            return Collections.emptyList();
        }

        // transform List<Version> to a List<String> using toString()
        return FluentIterable.from(rangeResult.getVersions()).transform(Functions.toStringFunction()).toList();
    }
 
开发者ID:MovingBlocks,项目名称:ModuleManager,代码行数:20,代码来源:RepositoryConnector.java

示例3: resolveVersionRange

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
private String resolveVersionRange(String groupId, String artifactId, String extension, String version)
        throws VersionRangeResolutionException {
    org.eclipse.aether.artifact.Artifact aetherArtifact = new org.eclipse.aether.artifact.DefaultArtifact(groupId,
            artifactId, extension, version);
    
    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact(aetherArtifact);
    rangeRequest.setRepositories(repositories);
    
    VersionRangeResult rangeResult = this.repositorySystem.resolveVersionRange(this.repoSession, rangeRequest);
    
    if (rangeResult == null || rangeResult.getHighestVersion() == null) {
        throw new VersionRangeResolutionException(rangeResult, "Unable to resolve version range fram " + groupId
                + ":" + artifactId + ":" + extension + ":" + version);
    }
    getLog().debug("Available versions: " + rangeResult.getVersions());
    return rangeResult.getHighestVersion().toString();
}
 
开发者ID:WASdev,项目名称:ci.maven,代码行数:19,代码来源:AbstractLibertySupport.java

示例4: getVersions

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
public List<Version> getVersions(Artifact artifact) throws VersionRangeResolutionException {
    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact( artifact );
    rangeRequest.setRepositories( repositories );

    VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );

    List<Version> versions = new ArrayList<Version>(rangeResult.getVersions());
    Collections.sort(versions);
    
    return versions;
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:13,代码来源:DependencyResolver.java

示例5: getLastVersion

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
/**
 * gets the last version of the current artifact, not including the current
 * one.
 * 
 * @return
 * @throws MojoExecutionException
 */
private org.eclipse.aether.version.Version getLastVersion()
		throws MojoExecutionException {

	// build the artifact description with version range from 0 up to (non
	// inclusive) current version

	String artifactDescription = ARTIFACT_DESCRIPTION.replace("groupId",
			groupId);
	artifactDescription = artifactDescription.replace("artifactId", name);
	artifactDescription = artifactDescription.replace("version", version);

	Artifact artifact = new DefaultArtifact(artifactDescription);
	getLog().info(
			String.format("searching for artifacts in range %s",
					artifactDescription));
	VersionRangeRequest rangeRequest = new VersionRangeRequest();
	rangeRequest.setArtifact(artifact);
	rangeRequest.setRepositories(projectRepos);

	VersionRangeResult rangeResult;
	try {
		rangeResult = repoSystem.resolveVersionRange(repoSession,
				rangeRequest);
		List<org.eclipse.aether.version.Version> versions = rangeResult
				.getVersions();
		getLog().debug(
				String.format("found versions %s",
						rangeResult.getVersions()));
		// could not find a previous version
		if (versions.isEmpty()) {
			return null;
		}
		org.eclipse.aether.version.Version lastVersion = versions
				.get(versions.size() - 1);
		getLog().debug(String.format("previous version is %s", lastVersion));
		return lastVersion;

	} catch (VersionRangeResolutionException e) {
		throw new MojoExecutionException("could not calculate  versions", e);
	}

}
 
开发者ID:santiagozky,项目名称:baselining-plugin,代码行数:50,代码来源:BaselineMojo.java

示例6: getNewestVersion

import org.eclipse.aether.resolution.VersionRangeRequest; //导入方法依赖的package包/类
public String getNewestVersion(String groupId, String artifactId) throws VersionRangeResolutionException {
    Artifact artifact = new DefaultArtifact(groupId, artifactId, "jar", "[0,)");

    VersionRangeRequest rangeRequest = new VersionRangeRequest();
    rangeRequest.setArtifact(artifact);
    rangeRequest.setRepositories(repositories);

    VersionRangeResult rangeResult = system.resolveVersionRange( session, rangeRequest );

    Version newestVersion = rangeResult.getHighestVersion();
    
    return newestVersion.toString();
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:14,代码来源:DependencyResolver.java


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