com.atlassian.maven.plugins.licenses
Class DownloadMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.atlassian.maven.plugins.licenses.AbstractLicensesMojo
com.atlassian.maven.plugins.licenses.DownloadMojo
- All Implemented Interfaces:
- org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
- DeployMojo
public class DownloadMojo
- extends AbstractLicensesMojo
After resolving all the dependencies of this project, for each one of them,
this mojo attemps to determine a valid URL for license location for this
project and download it.
First of all it attempts to extract the license location from the project
POM. If that fails - performs a search for other potential license locations
inside the JAR as defined in AbstractLicensesMojo.LICENSE_PATH_OPTIONS
The file name is structured as artifactId-version-LICENSE. For projects
with multiple licenses the file name is artifactId-version-LICENSE-n
where n is a license counter (starting from 0).
- Author:
- Sherali Karimov
|
Field Summary |
protected java.lang.String |
outputDirectory
Target directory where to save downloaded license files |
| Fields inherited from class com.atlassian.maven.plugins.licenses.AbstractLicensesMojo |
aggregate, artifactFactory, artifactMetadataSource, excludedLibraries, excludedLibraryList, excludedScopeList, excludedScopes, LICENSE_PATH_OPTIONS, LICENSE_TYPE, localRepository, mavenProjectBuilder, remoteRepositories, resolver |
| Fields inherited from interface org.apache.maven.plugin.Mojo |
ROLE |
|
Method Summary |
protected void |
downloadLicense(org.apache.maven.project.MavenProject depProject,
org.apache.maven.model.License license,
java.lang.String fileName)
Attemps to determine a valid URL for license location for this project
and download it. |
void |
execute()
|
protected java.lang.String |
generatePathToSaveLicense(org.apache.maven.artifact.Artifact artifact)
The file name is structured as artifactId-version-LICENSE |
| Methods inherited from class org.apache.maven.plugin.AbstractMojo |
getLog, getPluginContext, setLog, setPluginContext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
outputDirectory
protected java.lang.String outputDirectory
- Target directory where to save downloaded license files
DownloadMojo
public DownloadMojo()
execute
public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
downloadLicense
protected void downloadLicense(org.apache.maven.project.MavenProject depProject,
org.apache.maven.model.License license,
java.lang.String fileName)
throws org.apache.maven.plugin.MojoExecutionException
- Attemps to determine a valid URL for license location for this project
and download it.
- Parameters:
depProject - -
maven project of the artifact for which the license is being
looked uplicense - -
license object from the maven project. If this is null, this
method will search the artifact locationfileName - -
target file path where to save the license if found
- Throws:
org.apache.maven.plugin.MojoExecutionException
generatePathToSaveLicense
protected java.lang.String generatePathToSaveLicense(org.apache.maven.artifact.Artifact artifact)
- The file name is structured as artifactId-version-LICENSE
- Parameters:
artifact - -
artifact for which to generate the license output location
- Returns:
- file name for the license output location
Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.