Example usage for org.aspectj.bridge IMessage TASKTAG

List of usage examples for org.aspectj.bridge IMessage TASKTAG

Introduction

In this page you can find the example usage for org.aspectj.bridge IMessage TASKTAG.

Prototype

Kind TASKTAG

To view the source code for org.aspectj.bridge IMessage TASKTAG.

Click Source Link

Usage

From source file:AjcCompiler.java

License:Open Source License

/**
 * Hook into the maven logger.//w w w. jav a2 s  . c o  m
 */
public boolean handleMessage(IMessage message) {
    if (message.getKind().equals(IMessage.WARNING) && !isIgnoring(IMessage.WARNING))
        log.warning(message.getMessage());
    else if (message.getKind().equals(IMessage.DEBUG) && !isIgnoring(IMessage.DEBUG))
        log.fine(message.getMessage());
    else if (message.getKind().equals(IMessage.ERROR) && !isIgnoring(IMessage.ERROR))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.ABORT) && !isIgnoring(IMessage.ABORT))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.FAIL) && !isIgnoring(IMessage.FAIL))
        log.severe(message.getMessage());
    else if (message.getKind().equals(IMessage.INFO) && !isIgnoring(IMessage.INFO))
        log.fine(message.getMessage());
    else if (message.getKind().equals(IMessage.WEAVEINFO) && !isIgnoring(IMessage.WEAVEINFO))
        log.info(message.getMessage());
    else if (message.getKind().equals(IMessage.TASKTAG) && !isIgnoring(IMessage.TASKTAG))
        log.fine(message.getMessage());
    return super.handleMessage(message);
}

From source file:de.zalando.mojo.aspectj.MavenMessageHandler.java

License:Open Source License

/**
 * Copies output from the supplied message onto the active Maven Log.
 * If the message type (i.e. {@code message.getKind()}) is listed in the showDetailsForMessageKindList List,
 * the message is prefixed with location details (Class, row/line number etc.) as well.
 * <p/>//from  w  w w. j  a  va2  s .c  o  m
 * {@inheritDoc}
 */
public boolean handleMessage(final IMessage message) {

    // Compose the message text
    final StringBuilder builder = new StringBuilder(message.getMessage());
    if (isMessageDetailDesired(message)) {

        //
        // The AJC details are typically delivered on the format [fileName]:[lineNumber]
        // (i.e. /src/main/java/Clazz.java:16).
        //
        // Mimic this, and include the context of the message as well,
        // including guarding against NPEs.
        //
        final ISourceLocation sourceLocation = message.getSourceLocation();
        final String sourceFile = sourceLocation == null || sourceLocation.getSourceFile() == null
                ? "<unknown source file>"
                : sourceLocation.getSourceFile().getAbsolutePath();
        final String context = sourceLocation == null || sourceLocation.getContext() == null ? ""
                : sourceLocation.getContext() + "\n";
        final String line = sourceLocation == null ? "<no line information>" : "" + sourceLocation.getLine();

        builder.append("\n\t").append(sourceFile).append(":").append(line).append("\n").append(context);
    }

    final String messageText = builder.toString();

    if (isNotIgnored(message, IMessage.DEBUG) || isNotIgnored(message, IMessage.INFO)
            || isNotIgnored(message, IMessage.TASKTAG)) {

        // The DEBUG, INFO, and TASKTAG ajc message kinds are considered Maven Debug messages.
        log.debug(messageText);

    } else if (isNotIgnored(message, IMessage.WEAVEINFO)) {

        // The WEAVEINFO ajc message kind is considered Maven Info messages.
        log.info(messageText);

    } else if (isNotIgnored(message, IMessage.WARNING)) {

        // The WARNING ajc message kind is considered Maven Warn messages.
        log.warn(messageText);

    } else if (isNotIgnored(message, IMessage.ERROR) || isNotIgnored(message, IMessage.ABORT)
            || isNotIgnored(message, IMessage.FAIL)) {

        // We map ERROR, ABORT, and FAIL ajc message kinds to Maven Error messages.
        log.error(messageText);
    }

    // Delegate to normal handling.
    return super.handleMessage(message);
}