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


Java DefaultArtifactVersion.compareTo方法代码示例

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


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

示例1: checkForUpdate

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
public String checkForUpdate() {
    logger.finer("checkForUpdate");
    String result = null;
    final String current = getVersion();
    final String release = getLatestVersion();
    if (current != null && release != null) {
        logger.finer("Comparing current and release versions");
        final DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(current);
        final DefaultArtifactVersion releaseVersion = new DefaultArtifactVersion(release);
        final int compare = currentVersion.compareTo(releaseVersion);
        logger.finer("Comparing result is " + compare);
        if (compare != 0) {
            result = release;
        }
    }
    logger.finer("checkForUpdate result is " + result);
    return result;
}
 
开发者ID:paspiz85,项目名称:nanobot,代码行数:19,代码来源:BuildInfo.java

示例2: validateZsVersion

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
void validateZsVersion() {
	try {
		final String zsversion = params.getString("zsversion");
		if (StringUtils.isEmpty(zsversion))
		{
			errorCollection.addError("zsversion", textProvider.getText("com.zend.zendserver.plugins.zsversion.error"));
			throw new Exception("com.zend.zendserver.plugins.zsversion.error");
		}
		
    	DefaultArtifactVersion minVersion = new DefaultArtifactVersion(MIN_ZS_VERSION);
    	DefaultArtifactVersion zsVersion = new DefaultArtifactVersion(zsversion);
    	
    	if (zsVersion.compareTo(minVersion) == -1) {
            errorCollection.addError("zsversion", textProvider.getText("com.zend.zendserver.plugins.zsversion.too_old_zs"));
        }
    } catch (Exception e) {
    	errorCollection.addError("zsversion", textProvider.getText("com.zend.zendserver.plugins.zsversion.nan"));
    }
}
 
开发者ID:zend-patterns,项目名称:ZendServerBamboo,代码行数:20,代码来源:Validator.java

示例3: isFilterSupported

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
protected boolean isFilterSupported()
{
    String ffmpegVersionNumber = getFfmpegVersionNumber();
    if (ffmpegVersionNumber == null)
    {
        return false;
    }
    // TODO Better method than to assume nightly is greater than 1.0
    if (ffmpegVersionNumber.startsWith("N-"))
    {
        return true;
    }
    DefaultArtifactVersion filtersSupportedVersion = new DefaultArtifactVersion("0.7");
    DefaultArtifactVersion thisVersion = new DefaultArtifactVersion(ffmpegVersionNumber);
    return thisVersion.compareTo(filtersSupportedVersion) >= 0;
}
 
开发者ID:Alfresco,项目名称:gytheio,代码行数:17,代码来源:FfmpegContentTransformerWorker.java

示例4: isVersion1orGreater

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
public boolean isVersion1orGreater()
{
    String ffmpegVersionNumber = getFfmpegVersionNumber();
    if (ffmpegVersionNumber == null)
    {
        return false;
    }
    
    // TODO Better method than to assume nightly is greater than 1.0
    if (ffmpegVersionNumber.startsWith("N-"))
    {
        return true;
    }
    DefaultArtifactVersion version1 = new DefaultArtifactVersion("1.0");
    DefaultArtifactVersion thisVersion = new DefaultArtifactVersion(ffmpegVersionNumber);
    return thisVersion.compareTo(version1) >= 0;
}
 
开发者ID:Alfresco,项目名称:gytheio,代码行数:18,代码来源:FfmpegContentTransformerWorker.java

示例5: getConflictType

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
int getConflictType () {
    int ret = NO_CONFLICT;
    DefaultArtifactVersion includedV = new DefaultArtifactVersion(
            getArtifact().getArtifact().getVersion());
    int result;
    for (DependencyNode curDepN : getDuplicatesOrConflicts()) {
        if (curDepN.getState() == DependencyNode.OMITTED_FOR_CONFLICT) {
            result = includedV.compareTo(new DefaultArtifactVersion(curDepN.getArtifact().getVersion()));
            if (result < 0) {
                return CONFLICT;
            }
            if (result > 0) {
                ret = POTENTIAL_CONFLICT;
            }
        }
    }
    return ret;
}
 
开发者ID:timboudreau,项目名称:vl-jung,代码行数:19,代码来源:ArtifactGraphNode.java

示例6: ensureFeatures

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
private void ensureFeatures() throws IOException {
    if (gmCommand != null) return;
    ReaderWriterProcess proc = factory.getProcess(gmPath, "version");
    // Assuming version number is always in second word with delimiter ' '. $ gm version
    // GraphicsMagick 1.3.23 2015-11-07 Q16 http://www.GraphicsMagick.org/
    // Copyright (C) 2002-2015 GraphicsMagick Group.
    Scanner scanner = new Scanner(proc.getReader());
    try {
        if (!scanner.hasNextLine()) {
            throw new IOException(String.format("Could not detect your GraphicsMagick version, is '%s' in PATH?",
                    gmPath));
        }
        String[] firstLineInWords = scanner.nextLine().split(" ");
        version = new DefaultArtifactVersion(firstLineInWords[1]);
        this.gmCommand = version.compareTo(version_1_3_22) >= 0 ? getGMCommand(gmPath) : getGMCommandSafeMode(gmPath);
    } finally {
        scanner.close();
        proc.destroy();
    }
}
 
开发者ID:sharneng,项目名称:gm4java,代码行数:21,代码来源:GMProcessFactoryImpl.java

示例7: checkForUpdates

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
private synchronized void checkForUpdates()  {
    if (!buildTriggerProperties.isUpdateCheckEnabled())
        return;
    UUID correlationId = UUID.randomUUID();
    try {
        String currentVersion = pluginDescriptor.getPluginVersion();
        if (currentVersion == null) {
            LOG.warn(String.format("%s: Update check failed, couldn't get pluginDescriptor.getPluginVersion()", correlationId));
            UpdateChecker.updateIsAvailable = false;
            return;
        }
        String apiResponse = httpContentProvider.getContent(CacheManager.CacheNames.GitHubLatestRelease,
                new URI("https://api.github.com/repos/matt-richardson/teamcity-octopus-build-trigger-plugin/releases/latest"), correlationId);
        GitHubApiReleaseResponse githubApiReleaseResponse = new GitHubApiReleaseResponse(apiResponse);

        DefaultArtifactVersion gitHubVersion = new DefaultArtifactVersion(githubApiReleaseResponse.tagName);
        DefaultArtifactVersion pluginVersion = new DefaultArtifactVersion(currentVersion);

        UpdateChecker.currentVersion = pluginVersion.toString();
        UpdateChecker.latestVersion = gitHubVersion.toString();
        UpdateChecker.updateUrl = githubApiReleaseResponse.htmlUrl;
        UpdateChecker.updateIsAvailable = gitHubVersion.compareTo(pluginVersion) > 0;

        LOG.info(String.format("%s: Update check - current version is '%s', latest version is '%s' -> update available: %s", correlationId, pluginVersion, gitHubVersion, updateIsAvailable));
    }
    catch (Exception ex) {
        LOG.warn(String.format("%s: Update check failed, pretending no updates available", correlationId), ex);
        UpdateChecker.updateIsAvailable = false;
    }
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:31,代码来源:UpdateChecker.java

示例8: getIOSDriver

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
public static AppiumDriver getIOSDriver() throws Exception {
    idevicescreenshotCheck();
    if (platform == null) {
        platform = PlatformType.IOS;
    }
    if (platformVersion == null){
    	platformVersion = "";
    }
    if (automationName == null) {
        DefaultArtifactVersion version = new DefaultArtifactVersion(ideviceinfoCheck("ProductVersion"));
        DefaultArtifactVersion minVersion = new DefaultArtifactVersion("9.3.5");
        // Use XCUITest if device is above iOS version 9.3.5
        if (version.compareTo(minVersion) >= 0 ) {
            automationName = "XCUITest";
        } else {
            automationName = "Appium";
        }
    }
    if (udid == null) {
        udid = ideviceinfoCheck("UniqueDeviceID");
    }

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("automationName", automationName);
    capabilities.setCapability("platformName", platform.getPlatformName());
    capabilities.setCapability("deviceName", deviceName);
    if (udid != null)
        capabilities.setCapability("udid", udid);
    if (platformVersion != null)
        capabilities.setCapability("platformVersion", platformVersion);
    capabilities.setCapability("app", appFile);
    capabilities.setCapability("newCommandTimeout", 120);

    log("Creating Appium session, this may take couple minutes..");
    driver = new IOSDriver<MobileElement>(new URL("http://localhost:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(defaultWaitTime, TimeUnit.SECONDS);
    return driver;
}
 
开发者ID:bitbar,项目名称:testdroid-samples,代码行数:39,代码来源:AbstractAppiumTest.java

示例9: createTask

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
@Override
protected Task<VersionCheckResult> createTask() {
	return new Task<VersionCheckResult>() {

		@Override
		protected VersionCheckResult call() throws Exception {

			if (!VersionRetriever.isLocalInfoAvailable()) {
				LOGGER.error("could not find local version/build/timestamp");
				return null;
			}

			final String localVersionString = VersionRetriever.getLocalVersion();
			final String localBuildString = VersionRetriever.getLocalBuild();
			final String localTimestampString = VersionRetriever.getLocalTimestamp();

			final RemoteVersionResult remoteResult = VersionRetriever.getLatestVersion();

			if (remoteResult == null) {
				LOGGER.error("could not retrieve remote version");
				return null;
			}

			final DefaultArtifactVersion remoteVersion = new DefaultArtifactVersion(remoteResult.getVersion());
			final DefaultArtifactVersion localVersion = new DefaultArtifactVersion(localVersionString);

			final int result = localVersion.compareTo(remoteVersion);

			return new VersionCheckResult(remoteResult, localTimestampString, localBuildString, localVersionString, result);
		}
	};
}
 
开发者ID:JanStrauss,项目名称:skadi,代码行数:33,代码来源:VersionCheckerService.java

示例10: isClassMapKeySerializedWithPrefix

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
/**
 * Determines whether or not the Jackson library present will serialize a class Map
 * key with the 'class ' prefix.
 * 
 * @return true if a 'class ' prefix will be present in keys
 */
protected boolean isClassMapKeySerializedWithPrefix()
{
    StdKeySerializer keySerializer = new StdKeySerializer();
    Package keySerializerPackage = keySerializer.getClass().getPackage();
    String stringVersion = keySerializerPackage.getSpecificationVersion();
    DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(stringVersion);
    DefaultArtifactVersion behaviorChangedVersion = new DefaultArtifactVersion("2.5.1");
    return currentVersion.compareTo(behaviorChangedVersion) < 0;
}
 
开发者ID:Alfresco,项目名称:gytheio,代码行数:16,代码来源:JacksonDataFormatTest.java

示例11: getConflictType

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
private int getConflictType () {
    ArtifactGraphNode included = ((DependencyGraphScene)getScene()).getGraphNodeRepresentant(edge.getTarget());
    if (included == null) {
        return ArtifactGraphNode.NO_CONFLICT;
    }
    DefaultArtifactVersion edgeV = new DefaultArtifactVersion(edge.getTarget().getArtifact().getVersion());
    DefaultArtifactVersion includedV = new DefaultArtifactVersion(included.getArtifact().getArtifact().getVersion());
    int ret = edgeV.compareTo(includedV);
    return ret > 0 ? ArtifactGraphNode.CONFLICT : ret < 0 ?
        ArtifactGraphNode.POTENTIAL_CONFLICT : ArtifactGraphNode.NO_CONFLICT;
}
 
开发者ID:timboudreau,项目名称:vl-jung,代码行数:12,代码来源:EdgeWidget.java

示例12: copyArtifactsTo

import org.apache.maven.artifact.versioning.DefaultArtifactVersion; //导入方法依赖的package包/类
/**
 * Gets all dependency jars of the project specified by 'project' parameter from the local mirror and copies them
 * under targetFolder
 *
 * @param targetFolder The folder which the dependency jars will be copied to
 */
public static void copyArtifactsTo( MavenProject project, String targetFolder )
        throws MojoExecutionException {
    File targetFolderFile = new File( targetFolder );
    for ( Iterator it = project.getArtifacts().iterator(); it.hasNext(); ) {
        Artifact artifact = ( Artifact ) it.next();

        File f = artifact.getFile();

        LOG.info( "Artifact {} found.", f.getAbsolutePath() );

        if ( f == null ) {
            throw new MojoExecutionException( "Cannot locate artifact file of " + artifact.getArtifactId() );
        }

        // Check already existing artifacts and replace them if they are of a lower version
        try {

            List<String> existing =
                    FileUtils.getFileNames( targetFolderFile, artifact.getArtifactId() + "-*.jar", null, false );

            if ( existing.size() != 0 ) {
                String version =
                        existing.get( 0 ).split( "(" + artifact.getArtifactId() + "-)" )[1].split( "(.jar)" )[0];
                DefaultArtifactVersion existingVersion = new DefaultArtifactVersion( version );
                DefaultArtifactVersion artifactVersion = new DefaultArtifactVersion( artifact.getVersion() );

                if ( existingVersion.compareTo( artifactVersion ) < 0 ) { // Remove existing version
                    FileUtils.forceDelete( targetFolder + existing.get( 0 ) );
                }
                else {
                    LOG.info( "Artifact " + artifact.getArtifactId() + " with the same or higher " +
                            "version already exists in lib folder, skipping copy" );
                    continue;
                }
            }

            LOG.info( "Copying {} to {}", f.getName(), targetFolder );
            FileUtils.copyFileToDirectory( f.getAbsolutePath(), targetFolder );
        }
        catch ( IOException e ) {
            throw new MojoExecutionException( "Error while copying artifact file of " + artifact.getArtifactId(),
                    e );
        }
    }
}
 
开发者ID:apache,项目名称:usergrid,代码行数:52,代码来源:Utils.java


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