Example usage for org.apache.maven.classrealm ClassRealmRequest getType

List of usage examples for org.apache.maven.classrealm ClassRealmRequest getType

Introduction

In this page you can find the example usage for org.apache.maven.classrealm ClassRealmRequest getType.

Prototype

RealmType getType();

Source Link

Document

Gets the type of the class realm.

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  www .ja v  a 2  s.  c o m*/
                ClassLoader cl = Workspace.class.getClassLoader();
                request.getForeignImports().put("io.takari.incrementalbuild.workspace", cl);
            }
        }
    }
}

From source file:org.sonatype.maven.polyglot.PolyglotRealmDelegate.java

License:Open Source License

public void setupRealm(final ClassRealm realm, final ClassRealmRequest request) {
    assert realm != null;
    if (!ClassRealmRequest.RealmType.Project.equals(request.getType())) {
        try {/*  w  w  w .j  av  a 2 s  .c  om*/
            realm.importFrom("plexus.core", "org.sonatype.maven.polyglot.execute");
            // the plugin also need PolyglotModelManager
            realm.importFrom("plexus.core", "org.sonatype.maven.polyglot");
        } catch (Exception e) {
            throw new IllegalStateException("Could not import Polyglot extensions", e);
        }
    }
}