Example usage for org.apache.maven.classrealm ClassRealmConstituent getVersion

List of usage examples for org.apache.maven.classrealm ClassRealmConstituent getVersion

Introduction

In this page you can find the example usage for org.apache.maven.classrealm ClassRealmConstituent getVersion.

Prototype

String getVersion();

Source Link

Document

Gets the version of the constituent's artifact.

Usage

From source file:org.eclipse.m2e.core.internal.embedder.EclipseClassRealmManagerDelegate.java

License:Open Source License

private boolean supportsBuildApi(List<ClassRealmConstituent> constituents) {
    for (Iterator<ClassRealmConstituent> it = constituents.iterator(); it.hasNext();) {
        ClassRealmConstituent constituent = it.next();
        if ("org.sonatype.plexus".equals(constituent.getGroupId()) //$NON-NLS-1$
                && "plexus-build-api".equals(constituent.getArtifactId())) { //$NON-NLS-1$
            ArtifactVersion version = new DefaultArtifactVersion(constituent.getVersion());
            boolean compatible = currentBuildApiVersion.compareTo(version) >= 0;
            if (compatible) {
                // removing the JAR from the plugin realm to prevent discovery of the DefaultBuildContext
                it.remove();/*from ww  w .ja  va 2s .  co  m*/
            }
            return compatible;
        }
    }
    return false;
}