static void launchMps()

in mps-maven-plugin/src/main/java/org/jetbrains/mps/mavenplugin/Mps.java [20:43]


    static void launchMps(GeneratorStartupInfo generatorStartupInfo, GeneratorInput input, Log mavenLog) throws MojoExecutionException, MojoFailureException {
        CommandLine commandLine = getCommandLine(generatorStartupInfo, input);
        DefaultExecutor executor = new DefaultExecutor();

        LogOutputStream stream = new LogOutputStream() {
            @Override
            protected void processLine(String line, int logLevel) {
                mavenLog.info(line);
            }
        };

        executor.setWorkingDirectory(input.workingDirectory);
        executor.setStreamHandler(new PumpStreamHandler(stream));
        try {
            if (mavenLog.isDebugEnabled()) {
                mavenLog.debug("Executing " + commandLine);
            }
            executor.execute(commandLine);
        } catch (ExecuteException e) {
            throw new MojoFailureException("Process exited with error code " + e.getExitValue(), e);
        } catch (IOException e) {
            throw new MojoExecutionException("Could not execute command " + commandLine, e);
        }
    }