Class AbstractLicenseMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.github.robtimus.maven.plugins.buildhelper.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.StringlicenseFilenameThe name of the license file.private intmaxParentCountThe maximum number of parent directories to check.(package private) org.apache.maven.project.MavenProjectproject(package private) booleanskipLicenseSet this totrueto skip adding licenses to JAR files.
-
Constructor Summary
Constructors Constructor Description AbstractLicenseMojo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static voidabortIfGitRoot(java.nio.file.Path dir)voidexecute()(package private) static java.nio.file.PathfindLicenseFile(java.nio.file.Path baseDir, java.lang.String filename, int maxParentCount, org.apache.maven.plugin.logging.Log log)(package private) abstract voidprocessLicenseFile(java.nio.file.Path licenseFile)
-
-
-
Field Detail
-
project
@Parameter(defaultValue="${project}", readonly=true) org.apache.maven.project.MavenProject project
-
licenseFilename
@Parameter(defaultValue="LICENSE.txt", required=true) java.lang.String licenseFilenameThe name of the license file.- Since:
- 1.0
-
maxParentCount
@Parameter(defaultValue="0", required=true) private int maxParentCountThe 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 skipLicenseSet this totrueto skip adding licenses to JAR files.- Since:
- 1.0
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.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.MojoExecutionExceptionorg.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
-
-