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

Java Version类代码示例

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

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



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

示例1: getLatestBladeCLIJar

import aQute.bnd.version.Version; //导入依赖的package包/类
public static String getLatestBladeCLIJar() throws Exception {
	if (bladeJar == null) {
		URL url = new URL(System.getProperty("bladeURL"));
		File file = new File("blade.jar");

		FileUtils.copyURLToFile(url, file);

		Domain jar = Domain.domain(file);

		int bundleVersion = new Version(jar.getBundleVersion()).getMajor();

		if (bundleVersion != 2) {
			throw new Exception(
				"Expecting bladejar with major version 2, found version: " +
					bundleVersion);
		}

		bladeJar = file;
	}

	return bladeJar.getCanonicalPath();
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:23,代码来源:BladeCLIUtil.java


示例2: NvidiaGPUDetector

import aQute.bnd.version.Version; //导入依赖的package包/类
public NvidiaGPUDetector() {
	cudaVersion_driverVersion.put(new Version("2.0"), new Version("0.0")); // TODO cuda 2.0 supported from which driver version on? 
	cudaVersion_driverVersion.put(new Version("3.0"), new Version("195.36.15"));
	cudaVersion_driverVersion.put(new Version("3.1"), new Version("256.40"));
	cudaVersion_driverVersion.put(new Version("3.2"), new Version("260.19.26"));
	cudaVersion_driverVersion.put(new Version("4.0"), new Version("270.41.19"));
	cudaVersion_driverVersion.put(new Version("4.1"), new Version("285.05.33"));
	cudaVersion_driverVersion.put(new Version("4.2"), new Version("295.41"));
	cudaVersion_driverVersion.put(new Version("5.0"), new Version("304"));
	cudaVersion_driverVersion.put(new Version("5.5"), new Version("319"));
	cudaVersion_driverVersion.put(new Version("6.0"), new Version("331"));
	cudaVersion_driverVersion.put(new Version("6.5"), new Version("340"));
	cudaVersion_driverVersion.put(new Version("7.0"), new Version("346"));
	cudaVersion_driverVersion.put(new Version("7.5"), new Version("352"));
	cudaVersion_driverVersion.put(new Version("8.0"), new Version("367.40"));
}
 
开发者ID:ibcn-cloudlet,项目名称:dianne,代码行数:17,代码来源:NvidiaGPUDetector.java


示例3: wrap

import aQute.bnd.version.Version; //导入依赖的package包/类
/**
 * Wrap the file associated with this instance of {@code JarWrapper} if it is not a bundle already.
 * <p>
 * If the source file is already a bundle, nothing is done and this method returns the original file.
 * Notice that this means the returned file is not necessarily the same as the destination file.
 *
 * @param version version to give the bundle. If this is not a valid OSGi version, it will be converted to
 *                a {@link MavenVersion} and translated to a valid OSGi version.
 * @return the bundle file
 * @throws Exception if any error occurs while reading the source file or writing the destination bundle.
 */
public File wrap( String version ) throws Exception {
    if ( !jarFile.isFile() ) {
        throw new IllegalArgumentException( "Not a file: " + jarFile );
    }
    if ( version.trim().isEmpty() ) {
        throw new IllegalArgumentException( "Version must not be empty" );
    }

    try ( ZipFile input = new ZipFile( jarFile, ZipFile.OPEN_READ ) ) {
        if ( isBundle( input ) ) {
            return jarFile;
        }
    }

    final String name = ( artifactName == null ?
            subtract( jarFile.getName(), ".jar" ) : artifactName );

    try ( Jar newJar = new Jar( jarFile ) ) {
        Analyzer analyzer = new Analyzer();
        analyzer.setJar( newJar );
        analyzer.setBundleVersion( Version.isVersion( version ) ?
                Version.parseVersion( version ) :
                MavenVersion.parseString( version ).getOSGiVersion() );
        analyzer.setBundleSymbolicName( name );
        analyzer.setImportPackage( importInstructions );
        analyzer.setExportPackage( exportInstructions );

        File bundle = destination == null ?
                new File( jarFile.getParentFile(), name + "-osgi.jar" ) :
                destination;

        Manifest manifest = analyzer.calcManifest();

        return updateManifest( newJar, bundle, manifest );
    }
}
 
开发者ID:renatoathaydes,项目名称:osgiaas,代码行数:48,代码来源:JarWrapper.java


示例4: getLastArtifact

import aQute.bnd.version.Version; //导入依赖的package包/类
/**
 * gets the file for the last released artifact.
 * 
 * @return
 * @throws MojoExecutionException
 */
private File getLastArtifact() throws MojoExecutionException {
	org.eclipse.aether.version.Version v = getLastVersion();
	if (v == null) {
		return null;
	}

	Artifact artifactQuery = new DefaultArtifact(groupId.concat(":")
			.concat(name).concat(":").concat(v.toString()));
	getLog().debug(
			String.format("looking for artifact %s",
					artifactQuery.toString()));
	return getArtifactFile(artifactQuery);

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


示例5: getVersion

import aQute.bnd.version.Version; //导入依赖的package包/类
public Version getVersion(Attrs attrs) {
	if (attrs == null) {
		return Version.LOWEST;
	}
	return Version.parseVersion(attrs.get(Constants.VERSION_ATTRIBUTE));
}
 
开发者ID:apache,项目名称:incubator-taverna-osgi,代码行数:7,代码来源:MavenOsgiUtils.java


示例6: getLastVersion

import aQute.bnd.version.Version; //导入依赖的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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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