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

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

Introduction

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

Prototype

void warn(CharSequence content, Throwable error);

Source Link

Document

Send a message (and accompanying exception) to the user in the warn error level.
The error's stacktrace will be output when this error level is enabled.

Usage

From source file:fr.imag.adele.apam.maven.plugin.ACRInstallMojo.java

License:Apache License

public void execute() throws MojoExecutionException {
    getLog().info("execute(), outputAcr : " + outputAcr);
    URI repoXML = getTargetACR(outputAcr);

    if (repoXML != null) {
        String projectType = project.getPackaging();

        // ignore unsupported project types, useful when bundleplugin is configured in parent pom
        if (!supportedProjectTypes.contains(projectType)) {
            getLog().warn("Ignoring project type " + projectType + " - supportedProjectTypes = "
                    + supportedProjectTypes);
            return;
        }/*from ww w .j  a  v a2 s  . com*/

        String repoPath = outputAcr;
        if (repoPath.toLowerCase().endsWith(DOT_XML)) {
            repoPath = repoPath.substring(0, repoPath.lastIndexOf('/'));
        }

        // check for any attached sources or docs
        Log log = getLog();
        ObrUpdate update;

        try {

            URI acrXmlFile = ObrUtils.findObrXml(project);

            Config userConfig = new Config();

            update = new ObrUpdate(repoXML, acrXmlFile, project, repoPath, userConfig, log);
            update.parseRepositoryXml();

            updateLocalBundleMetadata(project.getArtifact(), update);

            update.writeRepositoryXml();
        } catch (Exception e) {
            log.warn("Exception while updating ACR : " + e.getLocalizedMessage(), e);
        }

    } else {
        getLog().info(
                "No output ACR specified and local ACR update disabled or incorrect (enable with -DoutputAcr),"
                        + " outputAcr = " + outputAcr);
        return;
    }

}

From source file:io.fabric8.maven.ApplyMojo.java

License:Apache License

protected void createRoutes(KubernetesClient kubernetes, Collection<HasMetadata> collection) {
    String routeDomainPostfix = this.routeDomain;
    Log log = getLog();
    String namespace = getNamespace();
    // lets get the routes first to see if we should bother
    try {// www.ja v a  2  s . com
        RouteList routes = kubernetes.adapt(OpenShiftClient.class).routes().inNamespace(namespace).list();
        if (routes != null) {
            routes.getItems();
        }
    } catch (Exception e) {
        log.warn("Cannot load OpenShift Routes; maybe not connected to an OpenShift platform? " + e, e);
        return;
    }
    List<Route> routes = new ArrayList<>();
    for (Object object : collection) {
        if (object instanceof Service) {
            Service service = (Service) object;
            Route route = createRouteForService(routeDomainPostfix, namespace, service, log);
            if (route != null) {
                routes.add(route);
            }
        }
    }
    collection.addAll(routes);
}

From source file:io.fabric8.maven.plugin.AbstractDeployMojo.java

License:Apache License

protected void createRoutes(Controller controller, Collection<HasMetadata> collection) {
    String routeDomainPostfix = this.routeDomain;
    Log log = getLog();
    String namespace = clusterAccess.getNamespace();
    // lets get the routes first to see if we should bother
    try {// w  w  w .  j a  v  a 2s  .c o m
        OpenShiftClient openshiftClient = controller.getOpenShiftClientOrNull();
        if (openshiftClient == null) {
            return;
        }
        RouteList routes = openshiftClient.routes().inNamespace(namespace).list();
        if (routes != null) {
            routes.getItems();
        }
    } catch (Exception e) {
        log.warn("Cannot load OpenShift Routes; maybe not connected to an OpenShift platform? " + e, e);
        return;
    }
    List<Route> routes = new ArrayList<>();
    for (Object object : collection) {
        if (object instanceof Service) {
            Service service = (Service) object;
            Route route = createRouteForService(routeDomainPostfix, namespace, service, log);
            if (route != null) {
                routes.add(route);
            }
        }
    }
    collection.addAll(routes);
}

From source file:io.fabric8.maven.plugin.AbstractDeployMojo.java

License:Apache License

protected void createIngress(Controller controller, KubernetesClient kubernetesClient,
        Collection<HasMetadata> collection) {
    String routeDomainPostfix = this.routeDomain;
    Log log = getLog();
    String namespace = clusterAccess.getNamespace();
    List<Ingress> ingressList = null;
    // lets get the routes first to see if we should bother
    try {//from ww  w. j  av  a2  s . c om
        IngressList ingresses = kubernetesClient.extensions().ingresses().inNamespace(namespace).list();
        if (ingresses != null) {
            ingressList = ingresses.getItems();
        }
    } catch (Exception e) {
        log.warn("Cannot load Ingress instances. Must be an older version of Kubernetes? Error: " + e, e);
        return;
    }
    List<Ingress> ingresses = new ArrayList<>();
    for (Object object : collection) {
        if (object instanceof Service) {
            Service service = (Service) object;
            if (!serviceHasIngressRule(ingressList, service)) {
                Ingress ingress = createIngressForService(routeDomainPostfix, namespace, service, log);
                if (ingress != null) {
                    ingresses.add(ingress);
                    log.info("Created ingress for " + namespace + ":" + KubernetesHelper.getName(service));
                } else {
                    log.debug("No ingress required for " + namespace + ":" + KubernetesHelper.getName(service));
                }
            } else {
                log.info("Already has ingress for service " + namespace + ":"
                        + KubernetesHelper.getName(service));
            }
        }
    }
    collection.addAll(ingresses);

}

From source file:io.fabric8.maven.plugin.mojo.build.ApplyMojo.java

License:Apache License

protected void createRoutes(Controller controller, Collection<HasMetadata> collection) {
    String routeDomainPostfix = this.routeDomain;
    Log log = getLog();
    String namespace = clusterAccess.getNamespace();
    // lets get the routes first to see if we should bother
    try {//from w  w w .  ja  v a2  s.com
        OpenShiftClient openshiftClient = controller.getOpenShiftClientOrNull();
        if (openshiftClient == null) {
            return;
        }
        RouteList routes = openshiftClient.routes().inNamespace(namespace).list();
        if (routes != null) {
            routes.getItems();
        }
    } catch (Exception e) {
        log.warn("Cannot load OpenShift Routes; maybe not connected to an OpenShift platform? " + e, e);
        return;
    }
    List<Route> routes = new ArrayList<>();
    for (Object object : collection) {
        if (object instanceof Service) {
            Service service = (Service) object;
            Route route = createRouteForService(routeDomainPostfix, namespace, service);
            if (route != null) {
                routes.add(route);
            }
        }
    }
    collection.addAll(routes);
}

From source file:io.fabric8.maven.plugin.mojo.build.ApplyMojo.java

License:Apache License

protected void createIngress(Controller controller, KubernetesClient kubernetesClient,
        Collection<HasMetadata> collection) {
    String routeDomainPostfix = this.routeDomain;
    Log log = getLog();
    String namespace = clusterAccess.getNamespace();
    List<Ingress> ingressList = null;
    // lets get the routes first to see if we should bother
    try {//from   w w w .j  a v a  2 s  .c o m
        IngressList ingresses = kubernetesClient.extensions().ingresses().inNamespace(namespace).list();
        if (ingresses != null) {
            ingressList = ingresses.getItems();
        }
    } catch (Exception e) {
        log.warn("Cannot load Ingress instances. Must be an older version of Kubernetes? Error: " + e, e);
        return;
    }
    List<Ingress> ingresses = new ArrayList<>();
    for (Object object : collection) {
        if (object instanceof Service) {
            Service service = (Service) object;
            if (!serviceHasIngressRule(ingressList, service)) {
                Ingress ingress = createIngressForService(routeDomainPostfix, namespace, service);
                if (ingress != null) {
                    ingresses.add(ingress);
                    log.info("Created ingress for " + namespace + ":" + KubernetesHelper.getName(service));
                } else {
                    log.debug("No ingress required for " + namespace + ":" + KubernetesHelper.getName(service));
                }
            } else {
                log.info("Already has ingress for service " + namespace + ":"
                        + KubernetesHelper.getName(service));
            }
        }
    }
    collection.addAll(ingresses);

}

From source file:io.fabric8.vertx.maven.plugin.utils.WatcherUtils.java

License:Apache License

/**
 * @param thread//from www.j  a v  a  2  s.  c  o m
 * @param timeout
 * @param logger
 */
private static void joinThread(Thread thread, int timeout, Log logger) {
    try {
        thread.join(timeout);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        logger.warn("Interrupted while joining thread " + thread, e);
    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Generate documentation related files using metadata
 *
 * @param namespaceMetaDataList      Metadata in this repository
 * @param documentationBaseDirectory The path of the directory in which the documentation will be generated
 * @param documentationVersion       The version of the documentation being generated
 * @param logger                     The logger to log errors
 * @throws MojoFailureException if the Mojo fails to find template file or create new documentation file
 *//*from w ww . j a v a2s.co m*/
public static void generateDocumentation(List<NamespaceMetaData> namespaceMetaDataList,
        String documentationBaseDirectory, String documentationVersion, Log logger)
        throws MojoFailureException {
    // Generating data model
    Map<String, Object> rootDataModel = new HashMap<>();
    rootDataModel.put("metaData", namespaceMetaDataList);
    rootDataModel.put("formatDescription", new FormatDescriptionMethod());
    rootDataModel.put("latestDocumentationVersion", documentationVersion);

    String outputFileRelativePath = Constants.API_SUB_DIRECTORY + File.separator + documentationVersion
            + Constants.MARKDOWN_FILE_EXTENSION;

    generateFileFromTemplate(
            Constants.MARKDOWN_DOCUMENTATION_TEMPLATE + Constants.MARKDOWN_FILE_EXTENSION
                    + Constants.FREEMARKER_TEMPLATE_FILE_EXTENSION,
            rootDataModel, documentationBaseDirectory, outputFileRelativePath);
    File newVersionFile = new File(documentationBaseDirectory + File.separator + outputFileRelativePath);
    File latestLabelFile = new File(documentationBaseDirectory + File.separator + Constants.API_SUB_DIRECTORY
            + File.separator + Constants.LATEST_FILE_NAME + Constants.MARKDOWN_FILE_EXTENSION);
    try {
        Files.copy(newVersionFile, latestLabelFile);
    } catch (IOException e) {
        logger.warn("Failed to generate latest.md file", e);
    }
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Build the mkdocs site using the mkdocs config file
 *
 * @param mkdocsConfigFile The mkdocs configuration file
 * @param logger           The maven logger
 * @return true if the documentation generation is successful
 *//*from  w ww  .jav  a2 s . co m*/
public static boolean generateMkdocsSite(File mkdocsConfigFile, Log logger) {
    boolean isDocumentationGenerationSuccessful = false;
    try {
        // Building the mkdocs site
        executeCommand(new String[] { Constants.MKDOCS_COMMAND, Constants.MKDOCS_BUILD_COMMAND,
                Constants.MKDOCS_BUILD_COMMAND_CLEAN_ARGUEMENT,
                Constants.MKDOCS_BUILD_COMMAND_CONFIG_FILE_ARGUMENT, mkdocsConfigFile.getAbsolutePath(),
                Constants.MKDOCS_BUILD_COMMAND_SITE_DIRECTORY_ARGUMENT, Constants.MKDOCS_SITE_DIRECTORY },
                logger);
        isDocumentationGenerationSuccessful = true;
    } catch (Throwable t) {
        logger.warn("Failed to generate the mkdocs site.", t);
    }
    return isDocumentationGenerationSuccessful;
}

From source file:io.siddhi.doc.gen.core.utils.DocumentationUtils.java

License:Open Source License

/**
 * Commit the documentation directory and the mkdocs config file
 *
 * @param docsDirectory    The docs drectory
 * @param mkdocsConfigFile The mkdocs configuration file
 * @param readmeFile       The read me file
 * @param version          The version of the documentation
 * @param logger           The maven logger
 *///from  ww w. ja va  2 s .c  o m
public static void updateDocumentationOnGitHub(String docsDirectory, File mkdocsConfigFile, File readmeFile,
        String version, Log logger) {
    try {
        executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_ADD_COMMAND, docsDirectory,
                mkdocsConfigFile.getAbsolutePath(), readmeFile.getAbsolutePath() }, logger);
        executeCommand(new String[] { Constants.GIT_COMMAND, Constants.GIT_COMMIT_COMMAND,
                Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT,
                String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version),
                Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT, docsDirectory, mkdocsConfigFile.getAbsolutePath(),
                readmeFile.getAbsolutePath() }, logger);
    } catch (Throwable t) {
        logger.warn("Failed to update the documentation on GitHub repository", t);
    }
}