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

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

Introduction

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

Prototype

void debug(Throwable error);

Source Link

Document

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

Usage

From source file:org.apache.karaf.tooling.features.Dependency30Helper.java

License:Apache License

@Override
public File resolve(Object artifact, Log log) {
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact((Artifact) artifact);
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + artifact + " from " + projectRepositories);

    ArtifactResult result;//w w  w .  j a  v  a 2  s. c o  m
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + artifact, e);
        return null;
    }

    log.debug("Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.karaf.tooling.features.Dependency30Helper.java

License:Apache License

@Override
public File resolveById(String id, Log log) throws MojoFailureException {
    id = MavenUtil.mvnToAether(id);/*from   www . j a v a  2s .  c o m*/
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(new DefaultArtifact(id));
    request.setRepositories((List<RemoteRepository>) projectRepositories);

    log.debug("Resolving artifact " + id + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + id, e);
        throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
    }

    log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.karaf.tooling.features.Dependency31Helper.java

License:Apache License

@Override
public File resolve(Object artifact, Log log) {
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact((Artifact) artifact);
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + artifact + " from " + projectRepositories);

    ArtifactResult result;/*from  w  ww  .j  ava 2s  . c  o m*/
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Cound not resolve " + artifact, e);
        return null;
    }

    log.debug("Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.karaf.tooling.features.Dependency31Helper.java

License:Apache License

@Override
public File resolveById(String id, Log log) throws MojoFailureException {
    id = MavenUtil.mvnToAether(id);/*from w  w  w.  jav a 2  s . c om*/
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(new DefaultArtifact(id));
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + id + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + id, e);
        throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
    }

    log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.karaf.tooling.utils.Dependency30Helper.java

License:Apache License

@Override
public File resolveById(String id, Log log) throws MojoFailureException {
    if (id.startsWith("mvn:")) {
        if (id.contains("!")) {
            id = id.substring(0, "mvn:".length()) + id.substring(id.indexOf("!") + 1);
        }/*from ww w.  ja va  2 s. c  om*/
        if (id.endsWith("/")) {
            id = id.substring(0, id.length() - 1);
        }
    }
    id = MavenUtil.mvnToAether(id);
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(new DefaultArtifact(id));
    request.setRepositories((List<RemoteRepository>) projectRepositories);

    log.debug("Resolving artifact " + id + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + id, e);
        throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
    }

    log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.karaf.tooling.utils.Dependency31Helper.java

License:Apache License

@Override
public File resolveById(String id, Log log) throws MojoFailureException {
    if (id.startsWith("mvn:")) {
        if (id.contains("!")) {
            id = id.substring(0, "mvn:".length()) + id.substring(id.indexOf("!") + 1);
        }//  w w w .j  a va2  s. c o m
        if (id.endsWith("/")) {
            id = id.substring(0, id.length() - 1);
        }
    }
    id = MavenUtil.mvnToAether(id);
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(new DefaultArtifact(id));
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + id + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + id, e);
        throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
    }

    log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}

From source file:org.apache.pluto.maven.AssembleMojo.java

License:Apache License

protected void doValidate() throws MojoExecutionException {
    Log log = getLog();

    // Support for the old 'warFiles' mojo parameter.  Apparently
    // the alias for the 'archives' parameter doesn't work properly.
    if (!(warFiles == null || warFiles.isEmpty())) {
        log.warn("'warFiles' parameter is deprecated.  Use 'archives' parameter instead.");
        if (archives == null) {
            archives = new ArrayList();
        }//www  .jav a2s .  c  o m
        archives.addAll(warFiles);
    }

    // Warn if the old 'warFilesDestination' mojo parameter is used
    if (warFilesDestination != null) {
        log.warn("'warFilesDestination' parameter is deprecated.  Use 'assemblyOutputDirectory' instead.");
        assemblyOutputDirectory = warFilesDestination;
    }

    // If a list of war files are supplied:
    //   1) webXml, portletXml, and webXmlDestination parameters are ignored
    //   2) verify the files in the List exist.
    //   3) verify the destination is a directory, or create it if it doesn't exist.

    // A list of files was supplied so we ignore other parameters. 
    if (archives != null && !archives.isEmpty()) {
        if (webXml != null) {
            log.debug(
                    "archives parameter and webXml parameter are mutually exclusive.  Ignoring webXml parameter.");
        }
        if (portletXml != null) {
            log.debug(
                    "archives parameter and portletXml parameter are mutually exclusive.  Ignoring portletXml parameter.");
        }
        if (webXmlDestination != null) {
            log.debug(
                    "archives parameter and webXmlDestination parameter are mutually exclusive.  Ignoring webXmlDestination parameter.");
        }

        // verify each file can be found
        for (Iterator i = archives.iterator(); i.hasNext();) {
            File f = new File(i.next().toString());
            if (!f.exists()) {
                log.warn("File " + f.getAbsolutePath() + " does not exist.");
                i.remove();
                continue;
            }
            if (!f.canRead()) {
                log.warn("File " + f.getAbsolutePath() + " exists but cannot be read.");
                i.remove();
                continue;
            }
        }

        // check to see if the warFiles list is now empty
        if (archives.isEmpty()) {
            throw new MojoExecutionException("No war files could be installed due errors.");
        }

        // check to see if the dest dir exists or create it.
        if (!assemblyOutputDirectory.exists()) {
            if (log.isDebugEnabled()) {
                log.debug("Creating destination directory for assembled war files: "
                        + assemblyOutputDirectory.getAbsolutePath());
            }
            try {
                if (!assemblyOutputDirectory.mkdirs()) {
                    throw new MojoExecutionException(
                            "Unable to create destination directory for assembled war files: "
                                    + assemblyOutputDirectory.getAbsolutePath());
                }
            } catch (SecurityException e) {
                throw new MojoExecutionException(
                        "Unable to create destination directory for assembled war files: " + e.getMessage(), e);
            }
        } else {
            if (!assemblyOutputDirectory.isDirectory()) {
                throw new MojoExecutionException("Specified destination for assembled war files "
                        + assemblyOutputDirectory.getAbsolutePath() + " is not a directory!");
            }
            if (!assemblyOutputDirectory.canRead() || !assemblyOutputDirectory.canWrite()) {
                throw new MojoExecutionException(
                        "Unable to read or write to destination directory for assembed war files.  "
                                + "Check permissions on the directory "
                                + assemblyOutputDirectory.getAbsolutePath());
            }
        }

        // A list of archive files was not provided, so use the other parameters instead.

    } else {
        if (webXml == null || !webXml.exists()) {
            throw new MojoExecutionException("Web application descriptor must be a valid web.xml");
        }
        if (portletXml == null || !portletXml.exists()) {
            throw new MojoExecutionException("Portlet descriptor must be a valid portlet.xml");
        }
    }
}

From source file:org.apache.rat.mp.util.ExclusionHelper.java

License:Apache License

public static void addPlexusAndScmDefaults(Log log, final boolean useDefaultExcludes,
        final Set<String> excludeList1) {
    if (useDefaultExcludes) {
        log.debug("Adding plexus default exclusions...");
        Collections.addAll(excludeList1, DirectoryScanner.DEFAULTEXCLUDES);
        log.debug("Adding SCM default exclusions...");
        excludeList1.addAll(//
                SourceCodeManagementSystems.getPluginExclusions());
    } else {//from ww  w.  ja  va 2 s .  c  o m
        log.debug("rat.useDefaultExcludes set to false. "
                + "Plexus and SCM default exclusions will not be added");
    }
}

From source file:org.apache.rat.mp.util.ExclusionHelper.java

License:Apache License

public static void addMavenDefaults(Log log, boolean useMavenDefaultExcludes, final Set<String> excludeList) {
    if (useMavenDefaultExcludes) {
        log.debug("Adding exclusions often needed by Maven projects...");
        excludeList.addAll(MAVEN_DEFAULT_EXCLUDES);
    } else {//from   w  ww  . j a va2s. com
        log.debug("rat.useMavenDefaultExcludes set to false. "
                + "Exclusions often needed by Maven projects will not be added.");
    }
}

From source file:org.apache.rat.mp.util.ExclusionHelper.java

License:Apache License

public static void addEclipseDefaults(Log log, boolean useEclipseDefaultExcludes,
        final Set<String> excludeList) {
    if (useEclipseDefaultExcludes) {
        log.debug("Adding exclusions often needed by projects " + "developed in Eclipse...");
        excludeList.addAll(ECLIPSE_DEFAULT_EXCLUDES);
    } else {//from w ww.  j  a v  a2s . co  m
        log.debug("rat.useEclipseDefaultExcludes set to false. "
                + "Exclusions often needed by projects developed in " + "Eclipse will not be added.");
    }
}