Example usage for org.springframework.ide.eclipse.boot.util DumpOutput DumpOutput

List of usage examples for org.springframework.ide.eclipse.boot.util DumpOutput DumpOutput

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.util DumpOutput DumpOutput.

Prototype

public DumpOutput(String streamName) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

@Override
public File executePackagingScript(IProgressMonitor monitor) throws CoreException {
    monitor.beginTask("Building War file", 100);
    try {/*from w  w  w .  j  a v a2s .  co m*/
        ILaunchConfiguration launchConf = createLaunchConfiguration(project, "package");
        ILaunch launch = launchConf.launch(MVN_LAUNCH_MODE, SubMonitor.convert(monitor, 10), true, true);
        if (DUMP_MAVEN_OUTPUT) {
            launch.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor()
                    .addListener(new DumpOutput("%mvn-out"));
            launch.getProcesses()[0].getStreamsProxy().getErrorStreamMonitor()
                    .addListener(new DumpOutput("%mvn-err"));
        }

        LaunchUtils.whenTerminated(launch).get();
        int exitValue = launch.getProcesses()[0].getExitValue();
        if (exitValue != 0) {
            throw ExceptionUtil.coreException("Non-zero exit-code(" + exitValue
                    + ") from maven war packaging. Check maven console for errors!");
        }
        return findWarFile();
    } catch (ExecutionException | InterruptedException e) {
        throw ExceptionUtil.coreException(e);
    } finally {
        monitor.done();
    }
}