Example usage for org.apache.maven.plugin.logging Log info

List of usage examples for org.apache.maven.plugin.logging Log info

Introduction

In this page you can find the example usage for org.apache.maven.plugin.logging Log info.

Prototype

void info(Throwable error);

Source Link

Document

Send an exception to the user in the info error level.
The stack trace for this exception will be output when this error level is enabled.

Usage

From source file:com.github.lucapino.confluence.AddAttachmentConfluenceMojo.java

License:Apache License

@Override
public void doExecute() throws MojoFailureException {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {/*  w  w w.jav  a2s  .c  o m*/
        for (File file : attachments) {
            addAttachment(page, file);
        }
    }
}

From source file:com.github.lucapino.confluence.AddBlogEntryConfluenceMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {// parse template
        String evaluate = processContent(entryFile);
        try {/*w  w  w.  j ava  2s  . c  o m*/
            // configure page
            Content content = new Content();
            content.setType(Type.BLOGPOST);
            content.setSpace(new Space(space));
            content.setTitle(entryTitle);
            content.setBody(new Body(new Storage(evaluate, Storage.Representation.STORAGE.toString())));
            getClient().postContent(content);
        } catch (MojoFailureException e) {
            throw fail("Unable to upload blog entry", e);
        }
    }
}

From source file:com.github.lucapino.confluence.AddCommentConfluenceMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {// parse template
        String evaluate = processContent(commentBody);
        try {/*w  ww. j  av a 2s  . c om*/
            // configure page
            ContentResultList contentResult = getClient().getContentBySpaceKeyAndTitle(page.getSpace(),
                    page.getTitle());
            Content parent = contentResult.getContents()[0];
            Parent parentPage = new Parent();
            parentPage.setId(parent.getId());
            Content content = new Content();
            content.setType(Type.COMMENT);
            content.setSpace(new Space(page.getSpace()));
            content.setTitle(page.getTitle());
            content.setAncestors(new Parent[] { parentPage });
            content.setBody(new Body(new Storage(evaluate, Storage.Representation.STORAGE.toString())));
            getClient().postContent(content);
        } catch (MojoFailureException e) {
            throw fail("Unable to upload blog entry", e);
        }
    }
}

From source file:com.github.lucapino.confluence.AddPageConfluenceMojo.java

License:Apache License

private void createPageObject(PageDescriptor parent, String content) throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {/*  w w w . j  a v a  2 s  . c o  m*/
        try {
            // configure page
            ContentResultList contentResult = getClient().getContentBySpaceKeyAndTitle(parent.getSpace(),
                    parent.getTitle());
            Content parentContent = contentResult.getContents()[0];
            Parent parentPage = new Parent();
            parentPage.setId(parentContent.getId());
            Content newPage = new Content();
            newPage.setType(Type.PAGE);
            newPage.setSpace(new Space(parent.getSpace()));
            newPage.setTitle(pageTitle);
            newPage.setAncestors(new Parent[] { parentPage });
            Storage newStorage;
            if (wikiFormat) {
                Storage contentStorage = new Storage(content, Storage.Representation.WIKI.toString());
                newStorage = getClient().convertContent(contentStorage, Storage.Representation.STORAGE);
            } else {
                newStorage = new Storage(content, Storage.Representation.STORAGE.toString());
            }
            newPage.setBody(new Body(newStorage));
            getClient().postContent(newPage);

            PageDescriptor newPageDescriptor = new PageDescriptor();

            if (!ArrayUtils.isEmpty(attachments)) {
                new AddAttachmentConfluenceMojo(this, newPageDescriptor, attachments).execute();
            }
        } catch (Exception e) {
            throw fail("Unable to upload page", e);
        }
    }
}

From source file:com.github.lucapino.confluence.UpdatePageConfluenceMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {//from   www. j  av a  2 s  .  co m
        if (!inputFile.exists()) {
            log.warn("No template file found. Mojo skipping.");
            return;
        }

        // configure page
        Content updatedPage = getClient().getContentBySpaceKeyAndTitle(parent.getSpace(), pageTitle)
                .getContents()[0];
        // always in storage format
        String oldContent = updatedPage.getBody().getStorage().getValue();
        String content = processContent(inputFile);
        Storage newStorage;
        if (wikiFormat) {
            Storage contentStorage = new Storage(content, Storage.Representation.WIKI.toString());
            newStorage = getClient().convertContent(contentStorage, Storage.Representation.STORAGE);
        } else {
            newStorage = new Storage(content, Storage.Representation.STORAGE.toString());
        }
        // now append or prepend
        if (prepend) {
            content = newStorage.getValue() + oldContent;
        } else if (append) {
            content = oldContent + newStorage.getValue();
        }
        newStorage.setValue(content);

        updatedPage.setBody(new Body(newStorage));
        getClient().postContent(updatedPage);

    }
}

From source file:com.github.lucapino.jira.AbstractJiraMojo.java

License:Apache License

@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        getLog().info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {/*from  w  w  w . ja  v  a2 s.  c o m*/
        if (isSkip()) {
            log.info("Skipping Plugin execution.");
            return;
        }
        try {
            initJiraClient();
            doExecute();
            jiraClient.getRestClient().close();
        } catch (Exception e) {
            log.error("Error when executing mojo", e);
            // XXX: Por enquanto nao faz nada.
        }
    }
}

From source file:com.github.lucapino.jira.CreateNewVersionMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();

    Project jiraProject = jiraClient.getRestClient().getProjectClient().getProject(jiraProjectKey).claim();
    Iterable<Version> versions = jiraProject.getVersions();
    String newDevVersion;/*from  w ww  .j a va2  s . com*/

    if (finalNameUsedForVersion) {
        newDevVersion = finalName;
    } else {
        newDevVersion = developmentVersion;
    }

    // Removing -SNAPSHOT suffix for safety and sensible formatting
    newDevVersion = WordUtils.capitalize(newDevVersion.replace("-SNAPSHOT", "").replace("-", " "));

    boolean versionExists = isVersionAlreadyPresent(versions, newDevVersion);

    if (!versionExists) {

        VersionInput newVersion = new VersionInput(jiraProjectKey, newDevVersion, null, null, false, false);
        log.debug("New Development version in JIRA is: " + newDevVersion);
        jiraClient.getRestClient().getVersionRestClient().createVersion(newVersion).claim();

        log.info("Version created in JIRA for project key " + jiraProjectKey + " : " + newDevVersion);
    } else {
        log.warn(String.format("Version %s is already created in JIRA. Nothing to do.", newDevVersion));
    }

}

From source file:com.github.lucapino.jira.ReleaseVersionMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {// w  ww  .  j  a  v a  2s.c  o  m
        VersionHolder thisReleaseVersion = calculateReleaseVersion();
        if (thisReleaseVersion != null) {
            log.info("Releasing Version " + thisReleaseVersion.getVersion().getName());
            markVersionAsReleased(thisReleaseVersion);
        }
    }
}

From source file:com.github.lucapino.jira.TransitionIssuesMojo.java

License:Apache License

@Override
public void doExecute() throws Exception {
    Log log = getLog();
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {//from ww w.  jav a  2s. c om
        if (transition == null) {
            log.info("Transition not specified. Nothing to do");
        }
        IssuesDownloader issuesDownloader = new IssuesDownloader();
        configureIssueDownloader(issuesDownloader);
        List<JiraIssue> issues = issuesDownloader.getIssueList();
        transitionIssues(issues, transition);
    }
}

From source file:com.github.maven.plugins.core.GitHubProjectMojo.java

License:Open Source License

/**
 * Log given message at info level//from w  ww  .jav a  2s  . c o  m
 * 
 * @param message
 */
protected void info(String message) {
    final Log log = getLog();
    if (log != null)
        log.info(message);
}