@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.HiddenLicenses, AbstractAddThirdPartyMojo.IncludedDependencies, AbstractAddThirdPartyMojo.IncludedLicensesDEP_SEPARATOR| 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.
|
String |
getExcludedArtifacts() |
String |
getExcludedGroups() |
List<String> |
getExcludedScopes() |
String |
getIncludedArtifacts() |
String |
getIncludedGroups() |
List<String> |
getIncludedScopes() |
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. |
getHelper, getLicenseMap, init, isFailIfWarning, isUseMissingFile, setExcludedLicenses, setIncludedLicensesacceptPackaging, addResourceDir, afterExecute, checkEncoding, execute, getBuildTimestamp, getEncoding, getProject, getSession, hasClassPath, isSkipAll, 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()
MavenProject, indexed by their gav.loadDependencies in class AbstractAddThirdPartyMojoprotected SortedProperties createUnsafeMapping() throws org.apache.maven.project.ProjectBuildingException, IOException, ThirdPartyToolException
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 porject for some dependenciesIOException - if could not load missing fileThirdPartyToolException - for third party tool errorpublic String getExcludedGroups()
getExcludedGroups in interface MavenProjectDependenciesConfiguratorartifactId, if null is setted the no exclude is
done on artifactId.public String getIncludedGroups()
getIncludedGroups in interface MavenProjectDependenciesConfiguratorgroupId, if null is setted then include
all artifacts.public List<String> getExcludedScopes()
getExcludedScopes in interface MavenProjectDependenciesConfiguratornull is setted, then include all scopes.public List<String> getIncludedScopes()
getIncludedScopes in interface MavenProjectDependenciesConfiguratornull is setted, then include all scopes.public String getExcludedArtifacts()
getExcludedArtifacts in interface MavenProjectDependenciesConfiguratorgroupId, if null is setted then no exclude
is done on groupId.public String getIncludedArtifacts()
getIncludedArtifacts in interface MavenProjectDependenciesConfiguratorartificatId, if null is setted then include
all artifacts.public 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.Copyright © 2010–2023. All rights reserved.