public interface ThirdPartyTool
We should put here all the logic code written in some mojo and licenseMap...
| Modifier and Type | Method and Description |
|---|---|
void |
addLicense(LicenseMap licenseMap,
org.apache.maven.project.MavenProject project,
org.apache.maven.model.License license)
Add a given
license to the given licenseMap for the given project. |
void |
addLicense(LicenseMap licenseMap,
org.apache.maven.project.MavenProject project,
List<?> licenses)
Add a given
licenses to the given licenseMap for the given project. |
void |
addLicense(LicenseMap licenseMap,
org.apache.maven.project.MavenProject project,
String... licenseNames)
Add one or more licenses (name and url are
licenseNames) to the given licenseMap for the given
project. |
void |
attachThirdPartyDescriptor(org.apache.maven.project.MavenProject project,
File file)
For the given
project, attach the given file as a third-party file. |
SortedSet<org.apache.maven.project.MavenProject> |
getProjectsWithNoLicense(LicenseMap licenseMap,
boolean doLog)
From the given
licenseMap, obtain all the projects with no license. |
boolean |
isVerbose()
Is log should be verbose?
|
SortedProperties |
loadThirdPartyDescriptorsForUnsafeMapping(Set<org.apache.maven.artifact.Artifact> dependencies,
String encoding,
Collection<org.apache.maven.project.MavenProject> projects,
SortedSet<org.apache.maven.project.MavenProject> unsafeProjects,
LicenseMap licenseMap,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories)
Collect license information from property file, 'third-party' classified artifacts, and .license.properties dependencies.
|
SortedProperties |
loadUnsafeMapping(LicenseMap licenseMap,
SortedMap<String,org.apache.maven.project.MavenProject> artifactCache,
String encoding,
File missingFile)
Loads unsafe mapping and returns it.
|
void |
mergeLicenses(LicenseMap licenseMap,
String mainLicense,
Set<String> licensesToMerge)
For a given
licenseMap, merge all licenses. |
void |
overrideLicenses(LicenseMap licenseMap,
SortedMap<String,org.apache.maven.project.MavenProject> artifactCache,
String encoding,
File overrideFile)
Override licenses from override file.
|
void |
overrideLicenses(LicenseMap licenseMap,
SortedMap<String,org.apache.maven.project.MavenProject> artifactCache,
String encoding,
String overrideFileUrl) |
File |
resolveMissingLicensesDescriptor(String groupId,
String artifactId,
String version,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> repositories) |
File |
resolvThirdPartyDescriptor(org.apache.maven.project.MavenProject project,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
Obtain the third party file from the repository.
|
void |
setVerbose(boolean verbose)
Sets the verbose mode.
|
void |
writeBundleThirdPartyFile(File thirdPartyFile,
File outputDirectory,
String bundleThirdPartyPath)
Writes the bundled version of the third-party file.
|
void |
writeThirdPartyFile(LicenseMap licenseMap,
File thirdPartyFile,
boolean verbose,
String encoding,
String template,
boolean custom)
Write the content of the third-party file.
|
static final String ROLE
boolean isVerbose()
true if verbose log should be produced, false otherwise.void setVerbose(boolean verbose)
verbose - new verbose mode to setSortedProperties loadThirdPartyDescriptorsForUnsafeMapping(Set<org.apache.maven.artifact.Artifact> dependencies, String encoding, Collection<org.apache.maven.project.MavenProject> projects, SortedSet<org.apache.maven.project.MavenProject> unsafeProjects, LicenseMap licenseMap, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories) throws ThirdPartyToolException, IOException
dependencies - top-level dependencies to scan for .license.properties files.encoding - encoding used to read or write properties filesprojects - all projects where to read third parties descriptorsunsafeProjects - all unsafe projectslicenseMap - license map where to store new licenseslocalRepository - local repositoryremoteRepositories - remote repositoriesThirdPartyToolException - if anyIOException - if anyvoid attachThirdPartyDescriptor(org.apache.maven.project.MavenProject project,
File file)
project, attach the given file as a third-party file.
The file will be attached as with a classifier third-parties and a type properties.
project - the project on which to attch the third-party filefile - the third-party file to attach.File resolvThirdPartyDescriptor(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> repositories) throws ThirdPartyToolException
Will first search in the local repository, then into the remote repositories and will resolv it.
project - the projectlocalRepository - the local repositoryrepositories - the remote repositoriesThirdPartyToolException - if anyFile resolveMissingLicensesDescriptor(String groupId, String artifactId, String version, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> repositories) throws IOException, org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException
IOExceptionorg.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundExceptionSortedSet<org.apache.maven.project.MavenProject> getProjectsWithNoLicense(LicenseMap licenseMap, boolean doLog)
licenseMap, obtain all the projects with no license.licenseMap - the license map to querydoLog - a flag to add debug logsSortedProperties loadUnsafeMapping(LicenseMap licenseMap, SortedMap<String,org.apache.maven.project.MavenProject> artifactCache, String encoding, File missingFile) throws IOException
licenseMap - license mapartifactCache - cache of dependencies (used for id migration from missing file)encoding - encoding used to load missing filemissingFile - location of the optional missing fileIOException - if pb while reading missing filevoid overrideLicenses(LicenseMap licenseMap, SortedMap<String,org.apache.maven.project.MavenProject> artifactCache, String encoding, File overrideFile) throws IOException
licenseMap - license mapartifactCache - cache of dependencies (used for id migration from missing file)encoding - encoding used to load override fileoverrideFile - location of the optional override fileIOException - if pb while reading override filevoid overrideLicenses(LicenseMap licenseMap, SortedMap<String,org.apache.maven.project.MavenProject> artifactCache, String encoding, String overrideFileUrl) throws IOException
IOExceptionvoid addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, String... licenseNames)
licenseNames) to the given licenseMap for the given
project.licenseMap - the license map where to add the licenseproject - the projectlicenseNames - the names of the licensesvoid addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, org.apache.maven.model.License license)
license to the given licenseMap for the given project.licenseMap - the license map where to add the licenseproject - the projectlicense - the license to addvoid addLicense(LicenseMap licenseMap, org.apache.maven.project.MavenProject project, List<?> licenses)
licenses to the given licenseMap for the given project.licenseMap - the license map where to add the licensesproject - the projectlicenses - the licenses to addvoid mergeLicenses(LicenseMap licenseMap, String mainLicense, Set<String> licensesToMerge)
licenseMap, merge all licenses.
The first value of the licenses is the license to keep and all other values will be merged into the
first one.
licenseMap - the license map to mergemainLicense - the main license to keeplicensesToMerge - all the licenses to mergevoid writeThirdPartyFile(LicenseMap licenseMap, File thirdPartyFile, boolean verbose, String encoding, String template, boolean custom) throws IOException
licenseMap - map of all license to usethirdPartyFile - location of file to generateverbose - verbose flagencoding - encoding used to generate filetemplate - the location of the freemarker template used to generate the file contentIOException - if any probem while writing filevoid writeBundleThirdPartyFile(File thirdPartyFile, File outputDirectory, String bundleThirdPartyPath) throws IOException
thirdPartyFile - location of normal third-party fileoutputDirectory - where to generate bundled version of the third-party filebundleThirdPartyPath - relative end path of the file to generateIOException - if any problem while writing fileCopyright © 2010–2023. All rights reserved.