Class LicenseFormatMojo

java.lang.Object
nl.javadude.gradle.plugins.license.maven.LicenseFormatMojo
All Implemented Interfaces:
com.mycila.maven.plugin.license.Callback, CallbackWithFailure

public final class LicenseFormatMojo extends Object implements CallbackWithFailure
CallbackWithFailure implementation for format mode: rewrites files that are missing their license header, optionally replacing any existing header first. In dry-run mode the result is written to a .licensed copy instead of the original file.

Inlined from hierynomus/license-gradle-plugin.

Since:
1.1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LicenseFormatMojo(File basedir, boolean dryRun, boolean skipExistingHeaders)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns all files that were affected (missing header or reformatted, depending on the concrete implementation).
    boolean
    Returns true if at least one file triggered a header violation during processing.
    void
    onExistingHeader(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
     
    void
    onHeaderNotFound(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
     
    void
    onUnknownFile(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • LicenseFormatMojo

      public LicenseFormatMojo(File basedir, boolean dryRun, boolean skipExistingHeaders)
  • Method Details

    • onHeaderNotFound

      public void onHeaderNotFound(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
      Specified by:
      onHeaderNotFound in interface com.mycila.maven.plugin.license.Callback
    • onUnknownFile

      public void onUnknownFile(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
      Specified by:
      onUnknownFile in interface com.mycila.maven.plugin.license.Callback
    • onExistingHeader

      public void onExistingHeader(com.mycila.maven.plugin.license.document.Document document, com.mycila.maven.plugin.license.header.Header header)
      Specified by:
      onExistingHeader in interface com.mycila.maven.plugin.license.Callback
    • hadFailure

      public boolean hadFailure()
      Description copied from interface: CallbackWithFailure
      Returns true if at least one file triggered a header violation during processing.
      Specified by:
      hadFailure in interface CallbackWithFailure
      Returns:
      true when there were failures
    • getAffected

      public Collection<File> getAffected()
      Description copied from interface: CallbackWithFailure
      Returns all files that were affected (missing header or reformatted, depending on the concrete implementation).
      Specified by:
      getAffected in interface CallbackWithFailure
      Returns:
      the affected files, never null