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

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

Introduction

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

Prototype

String getArtifactId();

Source Link

Document

Gets the artifact 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();/*from  ww  w  . j  a v  a 2s .co m*/
                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 a  va 2s. c o m*/
            }
            return compatible;
        }
    }
    return false;
}