Package org.codehaus.mojo.license
Class AggregatorAddThirdPartyMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.license.AbstractLicenseMojo
org.codehaus.mojo.license.AbstractAddThirdPartyMojo
org.codehaus.mojo.license.AggregatorAddThirdPartyMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="aggregate-add-third-party",
aggregator=true,
defaultPhase=GENERATE_RESOURCES,
requiresDependencyResolution=TEST,
threadSafe=true)
public class AggregatorAddThirdPartyMojo
extends AbstractAddThirdPartyMojo
This goal forks executions of the add-third-party goal for all the leaf projects
of the tree of modules below the point where it is executed. Note that this
plugin sets a specific name, 'add-third-party', for the forked executions in the
individual projects. From command level, then
even though the execution of this goal is named 'default-cli', the forked executions
have the name 'add-third-party'. Thus, to use the pluginManagement element of
the POM to set options, you have to name the execution 'add-third-party',
not 'default-cli'.
- Since:
- 1.0
- Author:
- tchemit dev@tchemit.fr
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codehaus.mojo.license.AbstractAddThirdPartyMojo
AbstractAddThirdPartyMojo.ExcludedLicenses, AbstractAddThirdPartyMojo.IncludedLicenses
-
Field Summary
Fields inherited from class org.codehaus.mojo.license.AbstractAddThirdPartyMojo
acceptPomPackaging, artifactFiltersUrl, bundleThirdPartyPath, dependencies, deployMissingFile, doGenerate, doGenerateBundle, excludedArtifacts, excludedGroups, excludedLicenses, excludedScopes, excludedTypes, failIfWarning, failOnBlacklist, failOnMissing, fileTemplate, force, generateBundle, includedArtifacts, includedGroups, includedLicenses, includedScopes, includedTypes, licenseMap, licenseMerges, licenseMergesFile, licenseMergesUrl, missingFile, missingFileUrl, missingLicensesFileArtifact, outputDirectory, projectDependencies, resolvedOverrideUrl, sortArtifactByName, thirdPartyFilename, unsafeDependencies, unsafeMappings, useMissingFile, useRepositoryMissingFiles
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
ConstructorsConstructorDescriptionAggregatorAddThirdPartyMojo
(ThirdPartyTool thirdPartyTool, DependenciesTool dependenciesTool) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Check if the project packaging is acceptable for the mojo.protected SortedProperties
Creates the unsafe mapping (says dependencies with no license given by their pom).protected void
doAction()
Do plugin action.protected void
init()
Method to initialize the mojo before doing any concrete actions.boolean
isSkip()
When is sets totrue
, will skip execution.Loads the dependencies of the project (asMavenProject
, indexed by their gav.protected boolean
Checks if the mojo execution should be skipped.Methods inherited from class org.codehaus.mojo.license.AbstractAddThirdPartyMojo
getHelper, setExcludedLicenses, setIncludedLicenses
Methods inherited from class org.codehaus.mojo.license.AbstractLicenseMojo
acceptPackaging, addResourceDir, afterExecute, checkEncoding, execute, getEncoding, getProject, hasClassPath, isVerbose, rejectPackaging, setEncoding, setVerbose
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
AggregatorAddThirdPartyMojo
@Inject public AggregatorAddThirdPartyMojo(ThirdPartyTool thirdPartyTool, DependenciesTool dependenciesTool)
-
-
Method Details
-
isSkip
public boolean isSkip()When is sets totrue
, will skip execution. This will take effect in at the very begin of theAbstractLicenseMojo.execute()
before any initialisation of goal.- Specified by:
isSkip
in classAbstractLicenseMojo
- Returns:
true
if goal will not be executed
-
checkPackaging
protected boolean checkPackaging()Check if the project packaging is acceptable for the mojo. By default, accept all packaging types. Note: This method is the first instruction to be executed in theAbstractLicenseMojo.execute()
. Tip: There is two method to simplify the packaging check :AbstractLicenseMojo.acceptPackaging(String...)
andAbstractLicenseMojo.rejectPackaging(String...)
- Overrides:
checkPackaging
in classAbstractLicenseMojo
- Returns:
true
if can execute the goal for the packaging of the project,false
otherwise.
-
shouldSkip
protected boolean shouldSkip()Checks if the mojo execution should be skipped.- Overrides:
shouldSkip
in classAbstractLicenseMojo
- Returns:
true
if the mojo should not be executed.
-
init
Description copied from class:AbstractAddThirdPartyMojo
Method to initialize the mojo before doing any concrete actions. Note: The method is invoked before theAbstractLicenseMojo.doAction()
method.- Overrides:
init
in classAbstractAddThirdPartyMojo
- Throws:
Exception
- if any
-
doAction
Do plugin action. The methodAbstractLicenseMojo.execute()
invoke this method only and only if :AbstractLicenseMojo.checkPackaging()
returnstrue
.- method
AbstractLicenseMojo.init()
returnstrue
.
- Specified by:
doAction
in classAbstractLicenseMojo
- Throws:
Exception
- if any
-
loadDependencies
Loads the dependencies of the project (asMavenProject
, indexed by their gav.- Specified by:
loadDependencies
in classAbstractAddThirdPartyMojo
- Returns:
- the map of dependencies of the maven project indexed by their gav.
-
createUnsafeMapping
protected SortedProperties createUnsafeMapping() throws org.apache.maven.project.ProjectBuildingException, IOException, org.apache.maven.plugin.MojoExecutionExceptionCreates the unsafe mapping (says dependencies with no license given by their pom).Can come from loaded missing file or from dependencies with no license at all.
- Specified by:
createUnsafeMapping
in classAbstractAddThirdPartyMojo
- Returns:
- the map of usafe mapping indexed by their gav.
- Throws:
org.apache.maven.project.ProjectBuildingException
- if could not create maven project for some dependenciesIOException
- if could not load missing fileorg.apache.maven.plugin.MojoExecutionException
-