public class DefaultThirdPartyHelper extends Object implements ThirdPartyHelper
ThirdPartyHelper.| Constructor and Description |
|---|
DefaultThirdPartyHelper(org.apache.maven.project.MavenProject project,
String encoding,
boolean verbose,
DependenciesTool dependenciesTool,
ThirdPartyTool thirdPartyTool,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories,
org.apache.maven.plugin.logging.Log log)
Constructor of the helper.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachThirdPartyDescriptor(File file)
Attach the third-party descriptor to the build.
|
LicenseMap |
createLicenseMap(Collection<org.apache.maven.project.MavenProject> dependencies,
String proxyUrl) |
LicenseMap |
createLicenseMap(SortedMap<String,org.apache.maven.project.MavenProject> dependencies,
String proxyUrl)
Creates a license map from given dependencies.
|
SortedProperties |
createUnsafeMapping(LicenseMap licenseMap,
File missingFile,
boolean useRepositoryMissingFiles,
SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies,
SortedMap<String,org.apache.maven.project.MavenProject> projectDependencies)
Loads unsafe mappings.
|
SortedMap<String,org.apache.maven.project.MavenProject> |
getArtifactCache()
Obtains the cache of loaded dependencies indexed by their gav.
|
SortedSet<org.apache.maven.project.MavenProject> |
getProjectsWithNoLicense(LicenseMap licenseMap)
Obtains all dependencies with no license form the given license map.
|
SortedMap<String,org.apache.maven.project.MavenProject> |
loadDependencies(MavenProjectDependenciesConfigurator configuration)
Load all dependencies given the configuration as
MavenProject. |
SortedProperties |
loadThirdPartyDescriptorForUnsafeMapping(Set<org.apache.maven.artifact.Artifact> topLevelDependencies,
SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies,
Collection<org.apache.maven.project.MavenProject> projects,
LicenseMap licenseMap)
Try to load maximum of unsafe license mapping using third-party descriptors (from maven repositories) and
return it.
|
SortedProperties |
loadUnsafeMapping(LicenseMap licenseMap,
File missingFile,
SortedMap<String,org.apache.maven.project.MavenProject> projectDependencies)
Load unsafe mapping for all dependencies with no license in their pom, we will load the missing file
if it exists and also add all dependencies from licenseMap with no license known.
|
void |
mergeLicenses(List<String> licenseMerges,
LicenseMap licenseMap)
Merges licenses.
|
public DefaultThirdPartyHelper(org.apache.maven.project.MavenProject project,
String encoding,
boolean verbose,
DependenciesTool dependenciesTool,
ThirdPartyTool thirdPartyTool,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories,
org.apache.maven.plugin.logging.Log log)
project - Current maven projectencoding - Encoding used to read and write filesverbose - Verbose flagdependenciesTool - tool to load dependenciesthirdPartyTool - tool to load third-parties descriptorslocalRepository - maven local repositoryremoteRepositories - maven remote repositorieslog - loggerpublic SortedMap<String,org.apache.maven.project.MavenProject> getArtifactCache()
getArtifactCache in interface ThirdPartyHelperpublic SortedMap<String,org.apache.maven.project.MavenProject> loadDependencies(MavenProjectDependenciesConfigurator configuration)
MavenProject.loadDependencies in interface ThirdPartyHelperconfiguration - the configuration of the project and include/exclude to do on his dependenciesMavenProject indexed by their gav.public SortedProperties loadThirdPartyDescriptorForUnsafeMapping(Set<org.apache.maven.artifact.Artifact> topLevelDependencies, SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies, Collection<org.apache.maven.project.MavenProject> projects, LicenseMap licenseMap) throws ThirdPartyToolException, IOException
loadThirdPartyDescriptorForUnsafeMapping in interface ThirdPartyHelpertopLevelDependencies - project dependencies to scan for .license.properties files.unsafeDependencies - all unsafe dependenciesprojects - all projects where to read third parties descriptorslicenseMap - license map where to store new licensesThirdPartyToolException - if anyIOException - if anypublic SortedProperties loadUnsafeMapping(LicenseMap licenseMap, File missingFile, SortedMap<String,org.apache.maven.project.MavenProject> projectDependencies) throws IOException
loadUnsafeMapping in interface ThirdPartyHelperlicenseMap - the license map of all dependencies.missingFile - location of an optional missing fille (says where you fix missing license).projectDependencies - project dependencies used to detect which dependencies in the missing file are unknown to the project.IOException - if could not load missing filepublic LicenseMap createLicenseMap(SortedMap<String,org.apache.maven.project.MavenProject> dependencies, String proxyUrl)
createLicenseMap in interface ThirdPartyHelperdependencies - dependencies to store in the license mappublic LicenseMap createLicenseMap(Collection<org.apache.maven.project.MavenProject> dependencies, String proxyUrl)
createLicenseMap in interface ThirdPartyHelperpublic void attachThirdPartyDescriptor(File file)
attachThirdPartyDescriptor in interface ThirdPartyHelperfile - location of the third-party descriptorpublic SortedSet<org.apache.maven.project.MavenProject> getProjectsWithNoLicense(LicenseMap licenseMap)
getProjectsWithNoLicense in interface ThirdPartyHelperlicenseMap - license map where to findpublic SortedProperties createUnsafeMapping(LicenseMap licenseMap, File missingFile, boolean useRepositoryMissingFiles, SortedSet<org.apache.maven.project.MavenProject> unsafeDependencies, SortedMap<String,org.apache.maven.project.MavenProject> projectDependencies) throws org.apache.maven.project.ProjectBuildingException, IOException, ThirdPartyToolException
There are three sources of this data:
license.properties. These are in the same format, and
provide global information.createUnsafeMapping in interface ThirdPartyHelperlicenseMap - license map to readmissingFile - location of an optional missing fileuseRepositoryMissingFiles - flag to use or not third-party descriptors via the 'third-party' classifier from maven repositoriesunsafeDependencies - all unsafe dependenciesprojectDependencies - all project dependenciesorg.apache.maven.project.ProjectBuildingException - if could not build some dependencies maven projectIOException - if could not load missing fileThirdPartyToolException - if pb with third-party toolpublic void mergeLicenses(List<String> licenseMerges, LicenseMap licenseMap) throws org.apache.maven.plugin.MojoFailureException
mergeLicenses in interface ThirdPartyHelperlicenseMerges - list of license mergeables (each entry is a list of licenses separated by |, the first one
is the license to use for all the others of the entry).licenseMap - license map to mergeorg.apache.maven.plugin.MojoFailureException - if there is a bad license merge definition (says for example two license with
same name)Copyright © 2010–2023. All rights reserved.