Example usage for org.apache.maven.cli CLIReportingUtils showError

List of usage examples for org.apache.maven.cli CLIReportingUtils showError

Introduction

In this page you can find the example usage for org.apache.maven.cli CLIReportingUtils showError.

Prototype

public static void showError(Logger logger, String message, Throwable e, boolean showStackTrace) 

Source Link

Usage

From source file:org.commonjava.emb.boot.main.EMBMain.java

License:Apache License

public int doMain(final CliRequest cliRequest) {
    try {/*from  w w w.j  av a2s .  c  o m*/
        initialize(cliRequest);
        // Need to process cli options first to get possible logging options
        cli(cliRequest);
        properties(cliRequest);
        settings(cliRequest);
        populateRequest(cliRequest);
        encryption(cliRequest);
        return execute(cliRequest);
    } catch (final ExitException e) {
        return e.exitCode;
    } catch (final Exception e) {
        CLIReportingUtils.showError(cliRequest.builder.logger(), "Error executing Maven.", e,
                cliRequest.builder.shouldShowErrors());

        return 1;
    } finally {
        if (cliRequest.fileStream != null) {
            cliRequest.fileStream.close();
        }
    }
}

From source file:org.topdesk.maven.tracker.MavenCli.java

License:Apache License

public int doMain(CliRequest cliRequest) {
    try {//from w  w w  . ja  v a  2s  .c o m
        initialize(cliRequest);
        // Need to process cli options first to get possible logging options
        cli(cliRequest);
        logging(cliRequest);
        commands(cliRequest);
        properties(cliRequest);
        container(cliRequest);
        settings(cliRequest);
        populateRequest(cliRequest);
        encryption(cliRequest);
        return execute(cliRequest);
    } catch (ExitException e) {
        return e.exitCode;
    } catch (UnrecognizedOptionException e) {
        // pure user error, suppress stack trace
        return 1;
    } catch (Exception e) {
        CLIReportingUtils.showError(logger, "Error executing Maven.", e, cliRequest.showErrors);

        return 1;
    } finally {
        if (cliRequest.fileStream != null) {
            cliRequest.fileStream.close();
        }
    }
}