public abstract class AbstractAddThirdPartyMojo extends AbstractLicenseMojo
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractAddThirdPartyMojo.ExcludedLicenses
Class to fill the
excludedLicenses parameter, from a simple string to split, or a list of string. |
static class |
AbstractAddThirdPartyMojo.IncludedLicenses
Class to fill the
includedLicenses parameter, from a simple string to split, or a list of string. |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
acceptPomPackaging
If
true the mojo will be executed for reactor projects having any packaging (including pom);
otherwise the mojo will be executed only for projects that do not have packaging pom. |
protected String |
artifactFiltersUrl
A URL returning a plain text file that contains include/exclude artifact filters in the following format:
|
protected String |
bundleThirdPartyPath
The path of the bundled third party file to produce when
generateBundle is on. |
protected Set<org.apache.maven.artifact.Artifact> |
dependencies
The set of dependencies for the current project, used to locate license databases.
|
protected DependenciesTool |
dependenciesTool
Dependencies tool.
|
protected boolean |
deployMissingFile
Attach the 'missing' file as an additional artifact so that it is deployed in the deploy phase.
|
protected boolean |
doGenerate
Flag computed in the
init() method to know if there is something has to be generated. |
protected boolean |
doGenerateBundle
Flag computed in the
init() method to know if a bundle version has to be generated. |
protected String |
excludedArtifacts
A regular expression (not glob pattern) used as filter to exclude
artifacts that have matching artifactId.
|
protected String |
excludedGroups
A regular expression (not glob pattern) used as filter to exclude
artifacts that have matching groupId.
|
protected AbstractAddThirdPartyMojo.ExcludedLicenses |
excludedLicenses
To specify some licenses to exclude.
|
protected String |
excludedScopes
A comma separated list of scopes to exclude: e.g.
|
protected String |
excludedTypes
A comma separated list of types to exclude: e.g.
|
protected boolean |
failIfWarning
Deprecated.
since 1.14, use now
failOnMissing or failOnBlacklist. |
protected boolean |
failOnBlacklist
A flag to fail the build if at least one dependency was blacklisted.
|
protected boolean |
failOnMissing
A flag to fail the build if at least one dependency was detected without a license.
|
protected String |
fileTemplate
Template used to build the third-party file.
|
protected boolean |
force
To force generation of the third-party file even if everything is up to date.
|
protected boolean |
generateBundle
A flag to copy a bundled version of the third-party file.
|
protected String |
includedArtifacts
A regular expression (not glob pattern) used as filter to include
only artifacts that have matching artifactId.
|
protected String |
includedGroups
A regular expression (not glob pattern) used as filter to include
only artifacts that have matching groupId.
|
protected AbstractAddThirdPartyMojo.IncludedLicenses |
includedLicenses
To specify some licenses to include.
|
protected String |
includedScopes
A comma separated list of scopes to include: e.g.
|
protected String |
includedTypes
A comma separated list of types to include.
|
protected LicenseMap |
licenseMap |
protected List<String> |
licenseMerges
To merge licenses in final file.
|
protected String |
licenseMergesFile
Deprecated.
prefer use now
licenseMergesUrl |
protected String |
licenseMergesUrl
Location of file with the merge licenses in order to be used by command line.
|
protected org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
Local Repository.
|
protected File |
missingFile
The file to write with a license information template for dependencies with unknown license.
|
protected String |
missingFileUrl
The Url that holds the missing license dependency entries.
|
protected String |
missingLicensesFileArtifact
To resolve third party licenses from an artifact.
|
protected File |
outputDirectory
Directory where to generate files.
|
protected SortedMap<String,org.apache.maven.project.MavenProject> |
projectDependencies |
protected List<org.apache.maven.artifact.repository.ArtifactRepository> |
remoteRepositories
Remote repositories used for the project.
|
protected String |
resolvedOverrideUrl
A URL prepared either our of
overrideFile or overrideUrl or the default value. |
protected boolean |
sortArtifactByName
A flag to sort artifact by name in the generated third-party file.
|
protected String |
thirdPartyFilename
File where to write the third-party file.
|
protected SortedSet<org.apache.maven.project.MavenProject> |
unsafeDependencies |
protected SortedProperties |
unsafeMappings |
protected boolean |
useMissingFile
A flag to use the missing licenses file to consolidate the THID-PARTY file.
|
protected boolean |
useRepositoryMissingFiles
Load files supplying information for missing third party licenses from repositories.
|
| Constructor and Description |
|---|
AbstractAddThirdPartyMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract SortedProperties |
createUnsafeMapping()
Creates the unsafe mapping (says dependencies with no license given by their pom).
|
protected ThirdPartyHelper |
getHelper() |
protected void |
init()
Method to initialize the mojo before doing any concrete actions.
|
protected abstract SortedMap<String,org.apache.maven.project.MavenProject> |
loadDependencies()
Loads the dependencies of the project (as
MavenProject, indexed by their gav. |
void |
setExcludedLicenses(String excludedLicenses)
Fill the
excludedLicenses parameter from a simple string to split. |
void |
setIncludedLicenses(String includedLicenses)
Fill the
includedLicenses parameter from a simple string to split. |
acceptPackaging, addResourceDir, afterExecute, checkEncoding, checkPackaging, checkSkip, doAction, execute, getBuildTimestamp, getEncoding, getProject, getSession, hasClassPath, isSkip, isVerbose, rejectPackaging, setEncoding, setVerbose@Parameter(property="license.outputDirectory",
defaultValue="${project.build.directory}/generated-sources/license",
required=true)
protected File outputDirectory
@Parameter(property="license.deployMissingFile",
defaultValue="true")
protected boolean deployMissingFile
@Parameter(property="license.useRepositoryMissingFiles",
defaultValue="true")
protected boolean useRepositoryMissingFiles
@Parameter(property="license.acceptPomPackaging",
defaultValue="false")
protected boolean acceptPomPackaging
true the mojo will be executed for reactor projects having any packaging (including pom);
otherwise the mojo will be executed only for projects that do not have packaging pom.
Since 1.18, when acceptPomPackaging is true, aggregate-add-third-party mojo is executed
also for the Maven session root project - i.e. the one out whose directory the mojo was executed.
Before 1.18, when acceptPomPackaging was true, aggregate-add-third-party mojo was
iterating over all modules in the reactor but the Maven session root project was skipped.
@Parameter(property="license.excludedScopes",
defaultValue="system")
protected String excludedScopes
<excludedScopes>test,provided</excludedScopes>
or -Dlicense.excludedScopes=test,provided.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies
are not automatically excluded. To enforce this behavior refer to
excludeTransitiveDependencies.
@Parameter(property="license.includedScopes") protected String includedScopes
<includedScopes>test,provided</includedScopes>
or -Dlicense.includedScopes=test,provided.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive
dependencies are included. To suppress this behavior refer to
includeTransitiveDependencies.
@Parameter(property="license.excludedTypes") protected String excludedTypes
<excludedTypes>war,pom</excludedTypes>
or -Dlicense.excludedTypes=was,pom.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies
are not automatically excluded. To enforce this behavior refer to
excludeTransitiveDependencies.
@Parameter(property="license.includedTypes") protected String includedTypes
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive
dependencies are included. To suppress this behavior refer to
includeTransitiveDependencies.
@Parameter(property="license.excludedGroups") protected String excludedGroups
^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies
are not automatically excluded. To enforce this behavior refer to
excludeTransitiveDependencies.
@Parameter(property="license.includedGroups") protected String includedGroups
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive
dependencies are included. To suppress this behavior refer to
includeTransitiveDependencies.
@Parameter(property="license.excludedArtifacts") protected String excludedArtifacts
^org\.
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is excluded its transitive dependencies
are not automatically excluded. To enforce this behavior refer to
excludeTransitiveDependencies.
@Parameter(property="license.includedArtifacts") protected String includedArtifacts
This filter is applied on the list of direct dependencies (and their transitive dependencies) of the projects in the reactor.
By default if an artifact is included also its transitive
dependencies are included. To suppress this behavior refer to
includeTransitiveDependencies.
@Parameter(property="license.thirdPartyFilename",
defaultValue="THIRD-PARTY.txt",
required=true)
protected String thirdPartyFilename
@Parameter(property="license.useMissingFile",
defaultValue="false")
protected boolean useMissingFile
@Parameter(property="license.missingFile",
defaultValue="src/license/THIRD-PARTY.properties")
protected File missingFile
@Parameter(property="license.missingFileUrl") protected String missingFileUrl
missingFile.
If set then the entries that will be found at this URL will be added additionally to the entries of the
missing file.@Parameter(property="license.missingLicensesFileArtifact") protected String missingLicensesFileArtifact
protected String resolvedOverrideUrl
overrideFile or overrideUrl or the default value.LicenseMojoUtils#prepareThirdPartyOverrideUrl(URL, File, String, File)@Parameter protected List<String> licenseMerges
Each entry represents a merge (first license is main license to keep), licenses are separated by |.
Example :
<licenseMerges>
<licenseMerge>The Apache Software License|Version 2.0,Apache License, Version 2.0</licenseMerge>
</licenseMerges>
</pre>
Note: This option will be overridden by licenseMergesUrl if it is used by command line.@Deprecated @Parameter(property="license.licenseMergesFile") protected String licenseMergesFile
licenseMergesUrllicenseMerges.@Parameter(property="license.licenseMergesUrl") protected String licenseMergesUrl
licenseMerges.@Parameter(property="license.includedLicenses") protected AbstractAddThirdPartyMojo.IncludedLicenses includedLicenses
If this parameter is filled and a license is not in this whitelist then build will fail when
property failOnBlacklist is true.
Since version 1.4, there are three ways to fill this parameter :
|), the way to use by property configuration:
<includedLicenses>licenseA|licenseB</includedLicenses>or
-Dlicense.includedLicenses=licenseA|licenseB
<includedLicenses> <includedLicense>licenseA</includedLicense> <includedLicenses>licenseB</includedLicense> </includedLicenses>
1.15
<includedLicenses>http://my.license.host.com/my-whitelist</includedLicenses>
the license-list on the given URL is expected to be list with a line-break after every entry e.g.:
@Parameter(property="license.excludedLicenses") protected AbstractAddThirdPartyMojo.ExcludedLicenses excludedLicenses
If a such license is found then build will fail when property failOnBlacklist is true.
Since version 1.4, there are three ways to fill this parameter :
|), the way to use by property configuration:
<excludedLicenses>licenseA|licenseB</excludedLicenses>or
-Dlicense.excludedLicenses=licenseA|licenseB
<excludedLicenses> <excludedLicense>licenseA</excludedLicense> <excludedLicense>licenseB</excludedLicense> </excludedLicenses>
1.15<includedLicenses>http://my.license.host.com/my-blacklist</includedLicenses>the license-list on the given URL is expected to be list with a line-break after every entry e.g.:
@Parameter(property="license.bundleThirdPartyPath",
defaultValue="META-INF/${project.artifactId}-THIRD-PARTY.txt")
protected String bundleThirdPartyPath
generateBundle is on.
Note: This option is not available for pom module types.
@Parameter(property="license.generateBundle",
defaultValue="false")
protected boolean generateBundle
The file will be copied at the bundleThirdPartyPath location.
@Parameter(property="license.force",
defaultValue="false")
protected boolean force
@Deprecated @Parameter(property="license.failIfWarning", defaultValue="false") protected boolean failIfWarning
failOnMissing or failOnBlacklist.@Parameter(property="license.failOnMissing",
defaultValue="false")
protected boolean failOnMissing
@Parameter(property="license.failOnBlacklist",
defaultValue="false")
protected boolean failOnBlacklist
@Parameter(property="license.sortArtifactByName",
defaultValue="false")
protected boolean sortArtifactByName
If not then artifacts are sorted by
groupId:artifactId:version
@Parameter(property="license.fileTemplate",
defaultValue="/org/codehaus/mojo/license/third-party-file.ftl")
protected String fileTemplate
(This template uses freemarker).
Note: This property can either point to a file or a resource on
the classpath. In case it points to a file and this plugin is used within
a sub-module as part of a multi-module build, you need to make this path
resolvable, e.g. by prepending basedir.
@Parameter(property="localRepository",
required=true,
readonly=true)
protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
@Parameter(property="project.remoteArtifactRepositories",
required=true,
readonly=true)
protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
@Parameter(property="project.artifacts",
required=true,
readonly=true)
protected Set<org.apache.maven.artifact.Artifact> dependencies
@Component protected DependenciesTool dependenciesTool
protected SortedMap<String,org.apache.maven.project.MavenProject> projectDependencies
protected LicenseMap licenseMap
protected SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies
protected SortedProperties unsafeMappings
protected boolean doGenerate
init() method to know if there is something has to be generated.protected boolean doGenerateBundle
init() method to know if a bundle version has to be generated.@Parameter(property="license.artifactFiltersUrl") protected String artifactFiltersUrl
# this is a comment
include gaPattern org\.my-org:my-artifact
include gaPattern org\.other-org:other-artifact
exclude gaPattern org\.yet-anther-org:.*
include scope compile
include scope test
exclude scope system
include type jar
exclude type war
protected abstract SortedMap<String,org.apache.maven.project.MavenProject> loadDependencies() throws DependenciesToolException
MavenProject, indexed by their gav.DependenciesToolException - if the dependencies could not be loadedprotected abstract SortedProperties createUnsafeMapping() throws org.apache.maven.project.ProjectBuildingException, IOException, ThirdPartyToolException, org.apache.maven.plugin.MojoExecutionException, DependenciesToolException
Can come from loaded missing file or from dependencies with no license at all.
org.apache.maven.project.ProjectBuildingException - if could not create maven project for some dependenciesIOException - if could not load missing fileThirdPartyToolException - for third party tool errorDependenciesToolException - if the dependencies could not be loadedorg.apache.maven.plugin.MojoExecutionExceptionprotected void init()
throws Exception
AbstractLicenseMojo.doAction() method.init in class AbstractLicenseMojoException - if anypublic void setIncludedLicenses(String includedLicenses) throws org.apache.maven.plugin.MojoExecutionException
includedLicenses parameter from a simple string to split.includedLicenses - license to excludes separated by a |.org.apache.maven.plugin.MojoExecutionExceptionpublic void setExcludedLicenses(String excludedLicenses) throws org.apache.maven.plugin.MojoExecutionException
excludedLicenses parameter from a simple string to split.excludedLicenses - license to excludes separated by a |.org.apache.maven.plugin.MojoExecutionExceptionprotected ThirdPartyHelper getHelper()
Copyright © 2010–2019 MojoHaus. All rights reserved.