use of org.apache.maven.artifact.versioning.DefaultArtifactVersion in project ats-framework by Axway.
the class AtsVersionVerifier method verifyVersion.
/**
* Perform a check between two ATS Versions
*
* @param thisVersion
* @param thatVersion
* @param comparison
* @return true if the evaluation succeeded, false otherwise
*/
@PublicAtsApi
public static boolean verifyVersion(String thisVersion, String thatVersion, Comparison comparison) {
DefaultArtifactVersion thisVer = new DefaultArtifactVersion(thisVersion);
DefaultArtifactVersion thatVer = new DefaultArtifactVersion(thatVersion);
return thisVer.compareTo(thatVer) == comparison.value;
}
use of org.apache.maven.artifact.versioning.DefaultArtifactVersion in project irontest by zheng-wang.
the class UpgradeActions method clearBrowserCacheIfNeeded.
private boolean clearBrowserCacheIfNeeded(DefaultArtifactVersion oldVersion, DefaultArtifactVersion newVersion) {
boolean clearBrowserCacheNeeded = false;
ClearBrowserCache cleanBrowserCache = new ClearBrowserCache();
Map<DefaultArtifactVersion, DefaultArtifactVersion> versionMap = cleanBrowserCache.getVersionMap();
for (Map.Entry<DefaultArtifactVersion, DefaultArtifactVersion> entry : versionMap.entrySet()) {
DefaultArtifactVersion fromVersion = entry.getKey();
DefaultArtifactVersion toVersion = entry.getValue();
if (fromVersion.compareTo(oldVersion) >= 0 && toVersion.compareTo(newVersion) <= 0) {
clearBrowserCacheNeeded = true;
break;
}
}
if (clearBrowserCacheNeeded) {
LOGGER.info("Please clear browser cached images and files (last hour is enough). To confirm clear completion, type y and then Enter.");
Scanner scanner = new Scanner(System.in);
String line = null;
while (!"y".equalsIgnoreCase(line)) {
line = scanner.nextLine().trim();
}
LOGGER.info("User confirmed browser cache clear completion.");
}
return clearBrowserCacheNeeded;
}
use of org.apache.maven.artifact.versioning.DefaultArtifactVersion in project gradle by gradle.
the class DefaultPomDependenciesConverter method compareMavenVersionStrings.
private int compareMavenVersionStrings(String dependencyVersionString, String duplicateVersionString) {
String dependencyVersion = emptyToNull(dependencyVersionString);
String duplicateVersion = emptyToNull(duplicateVersionString);
if (dependencyVersion == null && duplicateVersion == null) {
return 0;
}
if (dependencyVersion == null) {
return -1;
}
if (duplicateVersion == null) {
return 1;
}
ArtifactVersion dependencyArtifactVersion = new DefaultArtifactVersion(dependencyVersion);
ArtifactVersion duplicateArtifactVersion = new DefaultArtifactVersion(duplicateVersion);
return dependencyArtifactVersion.compareTo(duplicateArtifactVersion);
}
use of org.apache.maven.artifact.versioning.DefaultArtifactVersion in project maven-plugins by apache.
the class AbstractJavadocMojo method populateCompileArtifactMap.
/**
* Method to put the artifacts in the hashmap.
*
* @param compileArtifactMap the hashmap that will contain the artifacts
* @param artifactList the list of artifacts that will be put in the map
* @throws MavenReportException if any
*/
private void populateCompileArtifactMap(Map<String, Artifact> compileArtifactMap, Collection<Artifact> artifactList) throws MavenReportException {
if (artifactList == null) {
return;
}
for (Artifact newArtifact : artifactList) {
File file = newArtifact.getFile();
if (file == null) {
throw new MavenReportException("Error in plugin descriptor - " + "dependency was not resolved for artifact: " + newArtifact.getGroupId() + ":" + newArtifact.getArtifactId() + ":" + newArtifact.getVersion());
}
if (compileArtifactMap.get(newArtifact.getDependencyConflictId()) != null) {
Artifact oldArtifact = compileArtifactMap.get(newArtifact.getDependencyConflictId());
ArtifactVersion oldVersion = new DefaultArtifactVersion(oldArtifact.getVersion());
ArtifactVersion newVersion = new DefaultArtifactVersion(newArtifact.getVersion());
if (newVersion.compareTo(oldVersion) > 0) {
compileArtifactMap.put(newArtifact.getDependencyConflictId(), newArtifact);
}
} else {
compileArtifactMap.put(newArtifact.getDependencyConflictId(), newArtifact);
}
}
}
use of org.apache.maven.artifact.versioning.DefaultArtifactVersion in project sling by apache.
the class FsMountMojo method isBundleInstalled.
private boolean isBundleInstalled(Bundle bundle, String targetUrl) throws MojoExecutionException {
String installedVersionString = getBundleInstalledVersion(bundle.getSymbolicName(), targetUrl);
if (StringUtils.isBlank(installedVersionString)) {
return false;
}
DefaultArtifactVersion installedVersion = new DefaultArtifactVersion(installedVersionString);
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(bundle.getVersion());
return (installedVersion.compareTo(requiredVersion) >= 0);
}
Aggregations