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

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

Introduction

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

Prototype

String getGroupId();

Source Link

Document

Gets the group id of the constituent's artifact.

Usage

From source file:io.takari.m2e.incrementalbuild.core.internal.MavenComponentContributor.java

License:Open Source License

@Override
public void setupRealm(ClassRealm classRealm, ClassRealmRequest request) {
    if (request.getType() == RealmType.Plugin) {
        for (Iterator<ClassRealmConstituent> iter = request.getConstituents().iterator(); iter.hasNext();) {
            ClassRealmConstituent entry = iter.next();
            if ("io.takari".equals(entry.getGroupId())
                    && "incrementalbuild-workspace".equals(entry.getArtifactId())) {
                iter.remove();//w  w  w  . j ava2s  .  com
                ClassLoader cl = Workspace.class.getClassLoader();
                request.getForeignImports().put("io.takari.incrementalbuild.workspace", cl);
            }
        }
    }
}

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();//  w  w w  .j ava2s . c  o m
            }
            return compatible;
        }
    }
    return false;
}