Java Code Examples for org.apache.maven.artifact.versioning.ComparableVersion#compareTo()

The following examples show how to use org.apache.maven.artifact.versioning.ComparableVersion#compareTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionCommand.java    From gyro with Apache License 2.0 5 votes vote down vote up
public static void printUpdateVersion() throws IOException {
    ComparableVersion currentVersion = VersionCommand.getCurrentVersion();
    ComparableVersion latestVersion = VersionCommand.getLatestVersion();

    if (latestVersion != null) {
        Boolean isUpdateAvailable = currentVersion.compareTo(latestVersion) < 0;
        if (isUpdateAvailable) {
            VersionCommand.renderUpdateMessage(latestVersion.toString(), getOsName());
        }
    }
}
 
Example 2
Source File: SpringBootAndCloudVersion.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
boolean matchesSpringBootVersion(ComparableVersion versionToCheck) {
	int startVersionComparison = comparableBootStartVersion.compareTo(versionToCheck);
	int endVersionComparison = versionToCheck.compareTo(comparableBootEndVersion);
	return ((startVersionInclusive && startVersionComparison == 0)
			|| startVersionComparison <= -1)
			&& ((endVersionInclusive && endVersionComparison == 0)
					|| endVersionComparison <= -1);
}
 
Example 3
Source File: Library.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private static boolean newer(MavenCoordinates coordinates, MavenCoordinates previousCoordinates) {
  try {
    ComparableVersion version1 = new ComparableVersion(coordinates.getVersion());
    ComparableVersion version2 = new ComparableVersion(previousCoordinates.getVersion());
    
    return version1.compareTo(version2) > 0;
  } catch (IllegalArgumentException ex) {
    return false;
  }
}
 
Example 4
Source File: ProcessVersionComparator.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int compare(AbstractProcess o1, AbstractProcess o2) {
    ComparableVersion v1 = new ComparableVersion(o1.getVersion());
    ComparableVersion v2 = new ComparableVersion(o2.getVersion());
    return v1.compareTo(v2);
}