@Mojo(name="add-third-party",
requiresDependencyResolution=TEST,
defaultPhase=GENERATE_RESOURCES)
public class AddThirdPartyMojo
extends AbstractAddThirdPartyMojo
implements MavenProjectDependenciesConfigurator
This file contains a list of the dependencies and their licenses. Each dependency and its license is displayed on a single line in the format
(<license-name>) <project-name> <groupId>:<artifactId>:<version> - <project-url>The directory containing the license database file is added to the classpath as an additional resource.
AbstractAddThirdPartyMojo.ExcludedLicenses, AbstractAddThirdPartyMojo.IncludedLicensesacceptPomPackaging, artifactFiltersUrl, bundleThirdPartyPath, dependencies, dependenciesTool, deployMissingFile, doGenerate, doGenerateBundle, excludedArtifacts, excludedGroups, excludedLicenses, excludedScopes, excludedTypes, failIfWarning, failOnBlacklist, failOnMissing, fileTemplate, force, generateBundle, includedArtifacts, includedGroups, includedLicenses, includedScopes, includedTypes, licenseMap, licenseMerges, licenseMergesFile, licenseMergesUrl, localRepository, missingFile, missingFileUrl, missingLicensesFileArtifact, outputDirectory, projectDependencies, remoteRepositories, resolvedOverrideUrl, sortArtifactByName, thirdPartyFilename, unsafeDependencies, unsafeMappings, useMissingFile, useRepositoryMissingFiles| Constructor and Description |
|---|
AddThirdPartyMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkPackaging()
Check if the project packaging is acceptable for the mojo.
|
protected boolean |
checkSkip()
Checks if the mojo execution should be skipped.
|
protected SortedProperties |
createUnsafeMapping()
Creates the unsafe mapping (says dependencies with no license given by their pom).
|
protected void |
doAction()
Do plugin action.
|
ArtifactFilters |
getArtifactFilters() |
boolean |
isExcludeTransitiveDependencies() |
boolean |
isIncludeTransitiveDependencies() |
boolean |
isSkip()
When is sets to
true, will skip execution. |
protected SortedMap<String,org.apache.maven.project.MavenProject> |
loadDependencies()
Loads the dependencies of the project (as
MavenProject, indexed by their gav. |
protected ResolvedProjectDependencies |
resolveDependencyArtifacts()
Resolves the transitive and direct dependency sets for this project.
|
getHelper, init, setExcludedLicenses, setIncludedLicensesacceptPackaging, addResourceDir, afterExecute, checkEncoding, execute, getBuildTimestamp, getEncoding, getProject, getSession, hasClassPath, isVerbose, rejectPackaging, setEncoding, setVerbosegetLog, getPluginContext, setLog, setPluginContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisVerbosepublic boolean isSkip()
true, will skip execution.
This will take effect in at the very begin of the AbstractLicenseMojo.execute()
before any initialisation of goal.isSkip in class AbstractLicenseMojotrue if goal will not be executedprotected boolean checkPackaging()
AbstractLicenseMojo.execute().
Tip: There is two method to simplify the packaging check :
AbstractLicenseMojo.acceptPackaging(String...)
and
AbstractLicenseMojo.rejectPackaging(String...)checkPackaging in class AbstractLicenseMojotrue if can execute the goal for the packaging of the
project, false otherwise.protected boolean checkSkip()
checkSkip in class AbstractLicenseMojofalse if the mojo should not be executed.protected void doAction()
throws Exception
AbstractLicenseMojo.execute() invoke this method only and only if :
AbstractLicenseMojo.checkPackaging() returns true.AbstractLicenseMojo.init() returns true.doAction in class AbstractLicenseMojoException - if anyprotected SortedMap<String,org.apache.maven.project.MavenProject> loadDependencies() throws DependenciesToolException
MavenProject, indexed by their gav.loadDependencies in class AbstractAddThirdPartyMojoDependenciesToolException - if the dependencies could not be loadedprotected ResolvedProjectDependencies resolveDependencyArtifacts() throws DependenciesToolException
DependenciesToolException - if the dependencies could not be resolvedprotected 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.
createUnsafeMapping in class AbstractAddThirdPartyMojoorg.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.MojoExecutionExceptionpublic boolean isIncludeTransitiveDependencies()
isIncludeTransitiveDependencies in interface MavenProjectDependenciesConfiguratortrue if should include transitive dependencies, false to include only direct
dependencies.public boolean isExcludeTransitiveDependencies()
isExcludeTransitiveDependencies in interface MavenProjectDependenciesConfiguratortrue if should exclude transitive dependencies from excluded artifacts, else false.public ArtifactFilters getArtifactFilters()
getArtifactFilters in interface MavenProjectDependenciesConfiguratorArtifactFilters to apply when processing dependenciesCopyright © 2010–2019 MojoHaus. All rights reserved.