Example usage for org.apache.maven.execution MavenSession lookup

List of usage examples for org.apache.maven.execution MavenSession lookup

Introduction

In this page you can find the example usage for org.apache.maven.execution MavenSession lookup.

Prototype

@Deprecated
    public Object lookup(String role, String roleHint) throws ComponentLookupException 

Source Link

Usage

From source file:org.l2x6.maven.srcdeps.MojoExecutor.java

License:Apache License

public MojoExecutor(MavenSession session, Logger logger, SrcdepsConfiguration configuration) {
    super();/*w  w w  . j  a  v  a2s  .  c om*/
    this.logger = logger;

    final String os = System.getProperty("os.name").toLowerCase();
    this.isWindows = os.startsWith("windows");
    try {
        if (isWindows) {
            /*
             * this one does not support -q so let's use it only on Windows
             * where ForkedMavenExecutor does not work
             */
            this.mavenExecutor = (MavenExecutor) session.lookup(MavenExecutor.ROLE, "invoker");
        } else {
            this.mavenExecutor = (MavenExecutor) session.lookup(MavenExecutor.ROLE, "forked-path");
        }
        logger.debug("srcdeps-maven-plugin looked up a mavenExecutor [" + mavenExecutor.getClass() + "]");
    } catch (ComponentLookupException e) {
        throw new RuntimeException(e);
    }
    this.releaseEnvironment = new DefaultReleaseEnvironment().setJavaHome(configuration.getJavaHome())
            .setMavenHome(configuration.getMavenHome()).setSettings(session.getSettings());
}