Package org.apache.maven.plugin.logging

Examples of org.apache.maven.plugin.logging.Log


   * Is info logging enabled?
   *
   * @return true if enabled, false otherwise
   */
  protected boolean isInfo() {
    final Log log = getLog();
    return log != null ? log.isInfoEnabled() : false;
  }
View Full Code Here


   * Logger given message at debug level
   *
   * @param message
   */
  protected void debug(String message) {
    final Log log = getLog();
    if (log != null)
      log.debug(message);
  }
View Full Code Here

   *
   * @param message
   * @param throwable
   */
  protected void debug(String message, Throwable throwable) {
    final Log log = getLog();
    if (log != null)
      log.debug(message, throwable);
  }
View Full Code Here

   * Logger given message at info level
   *
   * @param message
   */
  protected void info(String message) {
    final Log log = getLog();
    if (log != null)
      log.info(message);
  }
View Full Code Here

   *
   * @param message
   * @param throwable
   */
  protected void info(String message, Throwable throwable) {
    final Log log = getLog();
    if (log != null)
      log.info(message, throwable);
  }
View Full Code Here

   * @see #getChangeLogResourceNames()
   *
   * @see ClassLoader#getResources(String)
   */
  public Collection<? extends URL> getChangeLogResources(final Iterable<? extends Artifact> artifacts) throws IOException {
    final Log log = this.getLog();
    Collection<URL> returnValue = null;
    final ClassLoader loader = this.toClassLoader(artifacts);
    if (loader != null) {
      final Iterable<String> changeLogResourceNames = this.getChangeLogResourceNames();
      if (log != null && log.isDebugEnabled()) {
        log.debug(String.format("Change log resource names: %s", changeLogResourceNames));
      }
      if (changeLogResourceNames == null) {
        throw new IllegalStateException("this.getChangeLogResourceNames()", new NullPointerException("this.getChangeLogResourceNames()"));
      }
      returnValue = new ArrayList<URL>();
View Full Code Here

   *
   * @see #assembleChangeLog()
   */
  @Override
  public void execute() throws MojoFailureException {
    final Log log = this.getLog();
    if (this.getSkip()) {
      if (log != null && log.isDebugEnabled()) {
        log.debug("Skipping execution by request");
      }
    } else {
      try {
        this.assembleChangeLog();
      } catch (final RuntimeException e) {
View Full Code Here

   * @see #getOutputFile()
   *
   * @see #write(String, Collection, File)
   */
  public final void assembleChangeLog() throws ArtifactResolutionException, DependencyGraphBuilderException, IOException {
    final Log log = this.getLog();
    final URL changeLogTemplateResource = this.getChangeLogTemplateResource();
    if (log != null && log.isDebugEnabled()) {
      log.debug(String.format("Change log template resource: %s", changeLogTemplateResource));
    }
    if (changeLogTemplateResource != null) {
      final String templateContents = this.readTemplate(changeLogTemplateResource);
      if (log != null && log.isDebugEnabled()) {
        log.debug(String.format("Change log template contents: %s", templateContents));
      }
      if (templateContents != null) {
        final Collection<? extends URL> urls = this.getChangeLogResources();
        if (log != null && log.isDebugEnabled()) {
          log.debug(String.format("Change log resources: %s", urls));
        }
        if (urls != null && !urls.isEmpty()) {
          final File outputFile = this.getOutputFile();
          if (log != null && log.isDebugEnabled()) {
            log.debug(String.format("Output file: %s", outputFile));
          }
          if (outputFile != null) {
            this.write(templateContents, urls, outputFile);
          }
        }
View Full Code Here

      variables.put("resources", urls);
      String encoding = this.getChangeLogCharacterEncoding();
      if (encoding == null) {
        encoding = "UTF-8";
      }
      final Log log = this.getLog();
      if (log != null && log.isDebugEnabled()) {
        log.debug(String.format("Writing change log to %s using character encoding %s", outputFile, encoding));
      }
      final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), encoding));
      try {
        TemplateRuntime.execute(compiledTemplate, this, new MapVariableResolverFactory(variables), null /* no TemplateRegistry */, new TemplateOutputWriter(writer));
      } finally {
View Full Code Here

   * @exception IOException if an input/output error occurs
   *
   * @see #getTemplateCharacterEncoding()
   */
  private final String readTemplate(final URL changeLogTemplateResource) throws IOException {
    final Log log = this.getLog();
    if (changeLogTemplateResource == null) {
      throw new IllegalArgumentException("changeLogTemplateResource", new NullPointerException("changeLogTemplateResource"));
    }
    String returnValue = null;
    final InputStream rawStream = changeLogTemplateResource.openStream();
    if (rawStream != null) {
      BufferedReader reader = null;
      String templateCharacterEncoding = this.getTemplateCharacterEncoding();
      if (templateCharacterEncoding == null) {
        templateCharacterEncoding = "UTF-8";
      }
      if (log != null && log.isDebugEnabled()) {
        log.debug(String.format("Reading change log template from %s using character encoding %s", changeLogTemplateResource, templateCharacterEncoding));
      }
      try {
        reader = new BufferedReader(new InputStreamReader(rawStream, templateCharacterEncoding));
        String line = null;
        final StringBuilder sb = new StringBuilder();
        while ((line = reader.readLine()) != null) {
          sb.append(line);
          sb.append(LS);
        }
        returnValue = sb.toString();
      } finally {
        try {
          rawStream.close();
        } catch (final IOException nothingWeCanDo) {

        }
        if (reader != null) {
          try {
            reader.close();
          } catch (final IOException nothingWeCanDo) {

          }
        }
      }
    } else if (log != null && log.isDebugEnabled()) {
      log.debug(String.format("Opening change log template %s results in a null InputStream.", changeLogTemplateResource));
    }
    return returnValue;
  }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.logging.Log

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.