Class AbstractLicenseMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    JarLicenseMojo, JavadocLicenseMojo

    abstract class AbstractLicenseMojo
    extends org.apache.maven.plugin.AbstractMojo
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String licenseFilename
      The name of the license file.
      private int maxParentCount
      The maximum number of parent directories to check.
      (package private) org.apache.maven.project.MavenProject project  
      (package private) boolean skipLicense
      Set this to true to skip adding licenses to JAR files.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private static void abortIfGitRoot​(java.nio.file.Path dir)  
      void execute()  
      (package private) static java.nio.file.Path findLicenseFile​(java.nio.file.Path baseDir, java.lang.String filename, int maxParentCount, org.apache.maven.plugin.logging.Log log)  
      (package private) abstract void processLicenseFile​(java.nio.file.Path licenseFile)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

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

      • project

        @Parameter(defaultValue="${project}",
                   readonly=true)
        org.apache.maven.project.MavenProject project
      • licenseFilename

        @Parameter(defaultValue="LICENSE.txt",
                   required=true)
        java.lang.String licenseFilename
        The name of the license file.
        Since:
        1.0
      • maxParentCount

        @Parameter(defaultValue="0",
                   required=true)
        private int maxParentCount
        The maximum number of parent directories to check. This allows locating the license file to abort early if it could not be found.
        Since:
        1.0
      • skipLicense

        @Parameter(property="robtimus.license.skip",
                   defaultValue="false")
        boolean skipLicense
        Set this to true to skip adding licenses to JAR files.
        Since:
        1.0
    • Constructor Detail

      • AbstractLicenseMojo

        AbstractLicenseMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • processLicenseFile

        abstract void processLicenseFile​(java.nio.file.Path licenseFile)
                                  throws org.apache.maven.plugin.MojoExecutionException,
                                         org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • findLicenseFile

        static java.nio.file.Path findLicenseFile​(java.nio.file.Path baseDir,
                                                  java.lang.String filename,
                                                  int maxParentCount,
                                                  org.apache.maven.plugin.logging.Log log)
                                           throws org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoFailureException
      • abortIfGitRoot

        private static void abortIfGitRoot​(java.nio.file.Path dir)
                                    throws org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoFailureException