Search in sources :

Example 16 with DefaultArtifactVersion

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;
}
Also used : DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 17 with DefaultArtifactVersion

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;
}
Also used : ResourcesScanner(org.reflections.scanners.ResourcesScanner) DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion)

Example 18 with DefaultArtifactVersion

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);
}
Also used : DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion) ArtifactVersion(org.apache.maven.artifact.versioning.ArtifactVersion) DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion)

Example 19 with DefaultArtifactVersion

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);
        }
    }
}
Also used : DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion) ArtifactVersion(org.apache.maven.artifact.versioning.ArtifactVersion) DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion) File(java.io.File) JavadocPathArtifact(org.apache.maven.plugin.javadoc.options.JavadocPathArtifact) Artifact(org.apache.maven.artifact.Artifact) DocletArtifact(org.apache.maven.plugin.javadoc.options.DocletArtifact) BootclasspathArtifact(org.apache.maven.plugin.javadoc.options.BootclasspathArtifact) ResourcesArtifact(org.apache.maven.plugin.javadoc.options.ResourcesArtifact) TagletArtifact(org.apache.maven.plugin.javadoc.options.TagletArtifact) MavenReportException(org.apache.maven.reporting.MavenReportException)

Example 20 with DefaultArtifactVersion

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);
}
Also used : DefaultArtifactVersion(org.apache.maven.artifact.versioning.DefaultArtifactVersion)

Aggregations

DefaultArtifactVersion (org.apache.maven.artifact.versioning.DefaultArtifactVersion)37 ArtifactVersion (org.apache.maven.artifact.versioning.ArtifactVersion)12 File (java.io.File)8 IOException (java.io.IOException)7 Model (org.apache.maven.model.Model)5 FileNotFoundException (java.io.FileNotFoundException)4 MavenXpp3Reader (org.apache.maven.model.io.xpp3.MavenXpp3Reader)4 ArrayList (java.util.ArrayList)3 Matcher (java.util.regex.Matcher)3 Artifact (org.apache.maven.artifact.Artifact)3 SPluginBundle (org.bimserver.interfaces.objects.SPluginBundle)3 SPluginBundleVersion (org.bimserver.interfaces.objects.SPluginBundleVersion)3 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)3 ArtifactDescriptorException (org.eclipse.aether.resolution.ArtifactDescriptorException)3 ArtifactResolutionException (org.eclipse.aether.resolution.ArtifactResolutionException)3 FileReader (java.io.FileReader)2 InputStream (java.io.InputStream)2 Path (java.nio.file.Path)2 HashMap (java.util.HashMap)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2