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.samaxes.maven.minify.common.SourceFilesEnumeration.java

License:Apache License

/**
 * Enumeration public constructor./*from  w w w.  java 2s.c  om*/
 *
 * @param log Maven plugin log
 * @param files list of files
 * @param verbose show source file paths in log output
 */
public SourceFilesEnumeration(Log log, List<File> files, boolean verbose) {
    this.files = files;
    if (!verbose)
        return;

    for (File file : files)
        log.info("Processing source file [" + file.getName() + "].");
}

From source file:com.samaxes.maven.plugin.common.ListOfFiles.java

License:Apache License

/**
 * ListOfFiles public constructor./* w  w  w .j av a  2  s  .co m*/
 * 
 * @param log Maven plugin log
 * @param files list of files
 */
public ListOfFiles(Log log, List<File> files) {
    this.files = files;

    log.info("Processing source files " + this.toString());
}

From source file:com.sap.prd.mobile.ios.mios.EffectiveBuildSettings.java

License:Apache License

private static synchronized Properties getBuildSettings(final XCodeContext context, final Log log)
        throws XCodeException {

    Properties _buildSettings = buildSettings.get(context);

    if (_buildSettings == null) {
        _buildSettings = extractBuildSettings(context);
        buildSettings.put(context, _buildSettings);
        log.info("Build settings for context: " + context + " loaded:" + toString(_buildSettings));
    } else {/*from  w  w w.  j a va2  s .c  o  m*/
        debug(log, "Build settings for key: '" + context + " found in cache.");
    }

    return _buildSettings;
}

From source file:com.sap.prd.mobile.ios.mios.XCodeValidationCheckMojo.java

License:Apache License

static Set<Artifact> parseDependencies(final Checks checks, final Log log) throws MojoExecutionException {
    final Set<Artifact> result = new HashSet<Artifact>();

    for (Check check : checks.getCheck()) {

        final String coords = StringUtils
                .join(Arrays.asList(check.getGroupId(), check.getArtifactId(), check.getVersion()), ":");

        if (coords.equals("::")) {
            log.info("No coordinates maintained for check represented by class '" + check.getClazz()
                    + "'. Assuming this check is already contained in the classpath.");
            continue;
        }//from  w  w  w .j  av a  2s .  c  om

        if (coords.matches("^:.*|.*:$|.*::.*"))
            throw new MojoExecutionException("Invalid coordinates: '" + coords
                    + "' maintained for check represented by class '" + check.getClazz()
                    + "'. At least one of groupId, artifactId or version is missing.");

        result.add(new DefaultArtifact(coords));
    }

    return result;
}

From source file:com.sap.research.maven.plugin.nwcloud.NWCloudGetPwdToMatch.java

License:Apache License

/**
 * Dump list of servers to given logger.
 * @param log org.apache.maven.plugin.logging.Log logger to use for dumping.
 *//*from  ww  w .  j  a  va  2 s .co m*/
public void dumpServerList(org.apache.maven.plugin.logging.Log log) {
    if (this.getServerList() != null) {
        for (Server server : this.getServerList()) {
            log.info(" - Server ID '" + server.getId() + "'");
            if (server.getPassword() != null) {
                log.info("    - Password is defined (but not shown)");
            } else {
                log.info("    - Password not defined");
            }
            log.info("    - Config '" + server.getConfiguration().toString() + "'");
        }
    } else {
        log.info("Returned list of servers was null.");
    }
}

From source file:com.sixsq.slipstream.SlipStreamMojo.java

License:Apache License

public void execute() throws MojoExecutionException {

    Log log = getLog();

    fillInAndValidateParameters();/*  w  ww .  j av a  2  s  .  c om*/

    DeploymentController controller = new DeploymentController(slipstreamServerUri, server.getUsername(),
            server.getPassword());

    // Ensure that the output directory exists.
    File outputDirectory = new File(targetDirectory);
    if (!outputDirectory.mkdirs()) {
        log.error(String.format("unable to create output directory: %s", outputDirectory.getAbsolutePath()));
    }

    try {

        controller.checkServerResponds();
        controller.login();
        controller.checkLogin();

        for (String module : deploymentModuleNames) {
            try {

                controller.verifyModuleExists(module);
                log.info(String.format("Module: %s", module));

                URI runUri = controller.runModule(module);
                log.info(String.format("Run URI: %s", runUri.toString()));

                pollServerUntilDone(log, runUri, controller);

                List<URI> reportUris = controller.getReports(runUri);

                List<File> localFiles = new ArrayList<File>();

                for (URI uri : reportUris) {
                    File localFile = controller.downloadFile(uri, outputDirectory);
                    localFiles.add(localFile);
                }

                attachArtifacts(log, localFiles);

            } catch (MojoExecutionException e) {
                log.warn(String.format("Error while running module %s: %s", module, e.getMessage()));
            }
        }

    } finally {
        closeReliably(controller, log);
    }

}

From source file:com.sixsq.slipstream.SlipStreamMojo.java

License:Apache License

private void pollServerUntilDone(Log log, URI runUri, DeploymentController controller)
        throws MojoExecutionException {

    while (true) {

        String[] response = controller.getRunStatus(runUri);
        log.info(String.format("state=%s, status=%s", response[0], response[1]));

        if (isTerminalState(response[0])) {
            break;
        }/* w ww  .  j  a  v  a 2 s . c o m*/

        try {
            long millis = pollIntervalInSeconds * MILLIS_PER_SECOND;
            Thread.sleep(millis);
        } catch (InterruptedException consumed) {
        }
    }

}

From source file:com.sixsq.slipstream.SlipStreamMojo.java

License:Apache License

private void attachArtifacts(Log log, List<File> files) {

    for (File file : files) {
        String type = getFileExtension(file);
        String classifier = getFileClassifier(file);
        projectHelper.attachArtifact(project, type, classifier, file);

        String fmt = "Attached artifact: %s with classifier=%s and type=%s";
        String msg = String.format(fmt, file.getAbsolutePath(), classifier, type);
        log.info(msg);
    }//from ww w.  j a v  a  2 s .c om
}

From source file:com.slim.service.BuildService.java

License:Apache License

public void buildear(MavenProject project, String outputDirectory, String archiveURI, String traHome,
        Log logger) throws MojoExecutionException {
    logger.info(" - BASE_DIR : " + project.getBasedir().toString());
    logger.info(" - TRA_HOME : " + traHome);
    logger.info(" - OUTPUT_DIRECTORY : " + outputDirectory);

    try {//www .  j  av  a 2 s  .co m
        CommandUtils.createDirectoryIfNeeded(project.getBasedir().toString() + "\\" + outputDirectory, logger);

        if (archiveURI == null || archiveURI.length() == 0) {
            archiveURI = "/" + project.getArtifact().getArtifactId();
        }

        Map<String, String> options = new HashMap<String, String>();
        options.put("-v", "");
        options.put("-xs", "");
        options.put(CommandUtils.EAR_OPTION, CommandUtils.GUILLEMETS + archiveURI + CommandUtils.GUILLEMETS);
        options.put(CommandUtils.PROJECT_OPTION, CommandUtils.GUILLEMETS + project.getBasedir().toString()
                + "\\" + project.getArtifact().getArtifactId() + CommandUtils.GUILLEMETS);
        options.put(CommandUtils.O_OPTION,
                CommandUtils.GUILLEMETS + project.getBasedir().toString() + "\\" + outputDirectory + "\\"
                        + project.getArtifact().getArtifactId() + ".ear" + CommandUtils.GUILLEMETS);

        BufferedReader buildOutput = CommandUtils.executeCommand(logger, traHome, CommandUtils.getBuildEarBin(),
                options);

        boolean isError = false;
        StringBuffer result = new StringBuffer();
        String line = null;
        while ((line = buildOutput.readLine()) != null) {
            if (line.contains("Error")) {
                isError = true;
            }
            result.append(line + "\n");
        }

        if (isError) {
            logger.error(result.toString());
            throw new Exception("Error in building ear ...");
        } else {
            logger.info(result.toString());
        }

    } catch (IOException e) {
        e.printStackTrace();
        throw new MojoExecutionException("Error", e);
    } catch (Throwable e) {
        e.printStackTrace();
        throw new MojoExecutionException("Error", e);
    }
}

From source file:com.slim.service.DeployService.java

License:Apache License

/**
 * //  w w  w  .  j  a  va 2  s .  co  m
 * @param project
 * @param hostServer
 * @param hostUser
 * @param hostPassword
 * @param tibcoDomain
 * @param tibcoUser
 * @param tibcoPassword
 * @param outputDirectory
 * @param remoteDirectory
 * @throws MojoExecutionException
 */
public void deploy(MavenProject project, String hostServer, String hostUser, String hostPassword,
        String tibcoDomain, String tibcoUser, String tibcoPassword, String outputDirectory,
        String remoteDirectory, String appLocation, Log logger) throws MojoExecutionException {
    // TODO Check parameter
    try {

        String appTibco = appLocation == null || appLocation.trim().length() == 0
                ? project.getArtifact().getArtifactId()
                : appLocation;

        String remotePath = remoteDirectory + "/" + appTibco;

        // Extrait le profil maven actuel
        String environnement = null;
        if (project.getActiveProfiles().size() > 0) {
            environnement = ((Profile) project.getActiveProfiles().get(0)).getId();
        } else {
            environnement = CommandUtils.DFT;
            ;
        }

        String localEarFile = project.getBasedir().toString() + "\\" + outputDirectory + "\\"
                + project.getArtifact().getArtifactId() + CommandUtils.SUFFIXE_EAR;

        String localXmlFile = project.getBasedir().toString() + "\\" + outputDirectory + "\\" + environnement
                + "\\" + project.getArtifact().getArtifactId() + CommandUtils.SUFFIXE_XML;

        String remoteEarFile = remotePath + "/" + project.getArtifact().getArtifactId()
                + CommandUtils.SUFFIXE_EAR;

        String remoteXmlFile = remotePath + "/" + project.getArtifact().getArtifactId()
                + CommandUtils.SUFFIXE_XML;

        SSHClientUtils sshclient = new SSHClientUtils(hostServer, hostUser, hostPassword, logger);

        logger.info("Creating directory " + remotePath + " ...");
        sshclient.sendShell("mkdir -p " + remotePath, remoteDirectory);

        logger.info("Moving " + localEarFile + " to " + remoteEarFile + " ...");
        sshclient.sendFile(localEarFile, remoteEarFile);

        logger.info("Moving " + localXmlFile + " to " + remoteXmlFile + " ...");
        sshclient.sendFile(localXmlFile, remoteXmlFile);

        StringBuilder commandDeploy = new StringBuilder();
        commandDeploy.append(CommandUtils.getRemoteAppManageBin()).append(" -deploy");
        commandDeploy.append(" -ear ").append(remoteEarFile);
        commandDeploy.append(" -deployconfig ").append(remoteXmlFile);
        commandDeploy.append(" -app ").append(appTibco);
        commandDeploy.append(" -domain ").append(tibcoDomain);
        commandDeploy.append(" -user ").append(tibcoUser);
        commandDeploy.append(" -pw ").append(tibcoPassword);

        logger.info("Executing " + commandDeploy.toString() + " ...");

        sshclient.sendShell(commandDeploy.toString(), remoteDirectory);

    } catch (Exception e) {
        e.printStackTrace();
        throw new MojoExecutionException("Error in deploying ear ..." + e.getMessage());
    }
}