Example usage for org.apache.maven BuildAbort BuildAbort

List of usage examples for org.apache.maven BuildAbort BuildAbort

Introduction

In this page you can find the example usage for org.apache.maven BuildAbort BuildAbort.

Prototype

public BuildAbort(String message, Throwable cause) 

Source Link

Usage

From source file:org.hudsonci.maven.eventspy_30.DelegatingEventSpy.java

License:Open Source License

@Override
public void init(final Context context) throws Exception {
    try {//  www  .  ja v a 2 s.  c  o m
        log.debug("Initializing w/context: {}", context);
        checkNotNull(context);
        super.init(context);

        // Spit out some trace information
        if (log.isTraceEnabled()) {
            log.trace("Context keys: {}", context.getData().keySet());
            log.trace("Container: {}", getContainer());
            log.trace("Working dir: {}", getWorkingDirectory());

            log.trace("Version properties:");
            for (Map.Entry entry : getVersionProperties().entrySet()) {
                log.trace("  {}='{}'", entry.getKey(), entry.getValue());
            }

            log.trace("User properties:");
            for (Map.Entry entry : getUserProperties().entrySet()) {
                log.trace("  {}='{}'", entry.getKey(), entry.getValue());
            }

            log.trace("System properties:");
            for (Map.Entry entry : getSystemProperties().entrySet()) {
                log.trace("  {}='{}'", entry.getKey(), entry.getValue());
            }
        }

        // Delegate is non-null in testing case
        if (delegate == null) {
            delegate = loadDelegate();
            log.debug("Delegate: {}", delegate);
        }

        getDelegate().init(context);
    } catch (Throwable e) {
        log.error("Init failed", e);

        // Abort on failure to init()
        if (e instanceof BuildAbort) {
            throw (BuildAbort) e;
        }
        throw new BuildAbort("Failed to initialize", e);
    }
}

From source file:org.hudsonci.maven.eventspy_30.DelegatingEventSpy.java

License:Open Source License

@Override
public void close() throws Exception {
    try {/*  w  ww .jav  a2s  .c o m*/
        log.debug("Closing");
        ensureOpened();
        getDelegate().close();
    } catch (Throwable e) {
        log.error("Close failed", e);

        // Abort on failure to close()
        if (e instanceof BuildAbort) {
            throw (BuildAbort) e;
        }
        throw new BuildAbort("Failed to close", e);
    }
}

From source file:org.hudsonci.maven.eventspy_30.EventSpyProcessor.java

License:Open Source License

@Override
protected void onFailure(final Exception cause) throws Exception {
    log.error("Processing failure; aborting Maven", cause);

    // FIXME: We should tell the Callback that we are aborting so it can more gracefully handle this, ATM it will look like an I/O failure when the process dies.

    throw new BuildAbort("Error occurred while processing events; aborting", cause);
}