org.nuiton.license.plugin
Class AddThirdPartyMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.license.plugin.AbstractLicenseMojo
              extended by org.nuiton.license.plugin.AddThirdPartyMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin
Direct Known Subclasses:
AddThirdPartyFileMojo

public class AddThirdPartyMojo
extends AbstractLicenseMojo

Le goal pour copier le fichier THIRD-PARTY.txt (contenant les licenses de toutes les dependances du projet) dans le classpath (et le generer s'il n'existe pas).

Since:
2.2 (was previously AddThirdPartyFileMojo).
Author:
tchemit
Is defined by the goal name:
add-third-party
Is bound to the specified phase of the standard build lifecycle:
generate-resources
Requires the dependencies in this specified scope:
test
Requires a Maven project to run:
true

Nested Class Summary
protected  class AddThirdPartyMojo.LicenseMap
           
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
 
Field Summary
protected  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
          Artifact metadata source component.
protected  String bundleThirdPartyPath
          The path of the bundled third party file to produce when generateBundle is on.
protected  org.apache.maven.artifact.resolver.ArtifactCollector collector
          Artifact collector component.
protected  boolean copyToMETA_INF
          Deprecated. since 2.2 (use instead generateBundle).
protected  org.apache.maven.shared.dependency.tree.DependencyTreeBuilder dependencyTreeBuilder
          Dependency tree builder component.
protected  org.apache.maven.artifact.factory.ArtifactFactory factory
          Artifact Factory component.
protected  boolean force
          Un flag pour forcer la generation.
protected  boolean generateBundle
          Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de l'artifact).
protected  boolean keepBackup
          Un flag pour conserver un backup des fichiers modifies.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          Local Repository.
protected  org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
          Maven Project Builder component.
static String NO_DEPENDENCIES_MESSAGE
           
protected  File outputDirectory
          Repertoire de sortie des classes (classpath).
protected  List<?> remoteRepositories
          Remote repositories used for the project.
protected  File thirdPartyFile
           
protected  String thirdPartyFileContent
          content of third party file (only computed if force is active or the thirdPartyFile does not exist, or is not up-to-date.
protected  String thirdPartyFilename
          Fichier ou ecrire les licences des dependances.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AddThirdPartyMojo()
           
 
Method Summary
protected  void buildLicenseMap(org.apache.maven.shared.dependency.tree.DependencyNode node, AddThirdPartyMojo.LicenseMap licenseMap)
           
protected  String buildThirdPartyFilecontent()
           
protected  boolean checkPackaging()
           
protected  void doAction()
           
protected  String getArtifactName(org.apache.maven.project.MavenProject artifactProject)
           
 String getBundleThirdPartyPath()
           
protected  org.apache.maven.project.MavenProject getMavenProjectFromRepository(org.apache.maven.artifact.Artifact artifact)
          Get the Maven project from the repository depending the Artifact given.
 File getOutputDirectory()
           
 File getThirdPartyFile()
           
 String getThirdPartyFileContent()
           
 String getThirdPartyFilename()
           
static String getUnknownLicenseMessage()
           
protected  void init()
           
 boolean isDoGenerate()
           
 boolean isForce()
           
 boolean isGenerateBundle()
           
 boolean isKeepBackup()
           
 void setBundleThirdPartyPath(String bundleThirdPartyPath)
           
 void setDoGenerate(boolean doGenerate)
           
 void setForce(boolean force)
           
 void setGenerateBundle(boolean generateBundle)
           
 void setKeepBackup(boolean keepBackup)
           
 void setOutputDirectory(File outputDirectory)
           
 void setThirdPartyFile(File thirdPartyFile)
           
 void setThirdPartyFileContent(String thirdPartyFileContent)
           
 void setThirdPartyFilename(String thirdPartyFilename)
           
 
Methods inherited from class org.nuiton.license.plugin.AbstractLicenseMojo
createLicenseStore, getEncoding, getProject, hasClassPath, isVerbose, setEncoding, setProject, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkResource, checkRunOnceDone, checkSkip, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getTemplate, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile
 
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
 
Methods inherited from interface org.apache.maven.plugin.Mojo
getLog, setLog
 

Field Detail

outputDirectory

protected File outputDirectory
Repertoire de sortie des classes (classpath).

Since:
1.0.0
Is defined by:
expression:
${license.outputDirectory}
default-value:
target/generated-sources/license
Is required.

thirdPartyFilename

protected String thirdPartyFilename
Fichier ou ecrire les licences des dependances.

Since:
1.0.0
Is defined by:
expression:
${license.thirdPartyFilename}
default-value:
THIRD-PARTY.txt
Is required.

generateBundle

protected boolean generateBundle
Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de l'artifact).

Since:
1.0.0
Is defined by:
expression:
${license.generateBundle}
default-value:
false

bundleThirdPartyPath

protected String bundleThirdPartyPath
The path of the bundled third party file to produce when generateBundle is on.

Note: This option is not available for pom module types.

Since:
2.2
Is defined by:
expression:
${license.bundleThirdPartyPath}
default-value:
META-INF/${project.artifactId}-THIRD-PARTY.txt

force

protected boolean force
Un flag pour forcer la generation.

Since:
1.0.0
Is defined by:
expression:
${license.force}
default-value:
false

keepBackup

protected boolean keepBackup
Un flag pour conserver un backup des fichiers modifies.

Since:
1.0.0
Is defined by:
expression:
${license.keepBackup}
default-value:
false

copyToMETA_INF

@Deprecated
protected boolean copyToMETA_INF
Deprecated. since 2.2 (use instead generateBundle).
Un flag pour faire une copie nommé dans META-INF (prefixe avec le nom de l'artifact).

Since:
1.0.0
Is defined by:
expression:
${license.generateBundle}
default-value:
false

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Local Repository.

Since:
1.0.0
Is defined by:
expression:
${localRepository}
Is readonly.
Is required.

remoteRepositories

protected List<?> remoteRepositories
Remote repositories used for the project.

Since:
1.0.0
Is defined by:
expression:
${project.remoteArtifactRepositories}
Is readonly.
Is required.

dependencyTreeBuilder

protected org.apache.maven.shared.dependency.tree.DependencyTreeBuilder dependencyTreeBuilder
Dependency tree builder component.

Is a Plexus component defined by:

factory

protected org.apache.maven.artifact.factory.ArtifactFactory factory
Artifact Factory component.

Is a Plexus component defined by:

artifactMetadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
Artifact metadata source component.

Is a Plexus component defined by:

collector

protected org.apache.maven.artifact.resolver.ArtifactCollector collector
Artifact collector component.

Is a Plexus component defined by:

mavenProjectBuilder

protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
Maven Project Builder component.

Is a Plexus component defined by:

thirdPartyFileContent

protected String thirdPartyFileContent
content of third party file (only computed if force is active or the thirdPartyFile does not exist, or is not up-to-date.


thirdPartyFile

protected File thirdPartyFile

NO_DEPENDENCIES_MESSAGE

public static final String NO_DEPENDENCIES_MESSAGE
See Also:
Constant Field Values
Constructor Detail

AddThirdPartyMojo

public AddThirdPartyMojo()
Method Detail

checkPackaging

protected boolean checkPackaging()
Overrides:
checkPackaging in class org.nuiton.plugin.AbstractPlugin

init

protected void init()
             throws Exception
Specified by:
init in class org.nuiton.plugin.AbstractPlugin
Throws:
Exception

doAction

protected void doAction()
                 throws Exception
Specified by:
doAction in class org.nuiton.plugin.AbstractPlugin
Throws:
Exception

buildThirdPartyFilecontent

protected String buildThirdPartyFilecontent()
                                     throws org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException
Throws:
org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException

buildLicenseMap

protected void buildLicenseMap(org.apache.maven.shared.dependency.tree.DependencyNode node,
                               AddThirdPartyMojo.LicenseMap licenseMap)

getArtifactName

protected String getArtifactName(org.apache.maven.project.MavenProject artifactProject)

getMavenProjectFromRepository

protected org.apache.maven.project.MavenProject getMavenProjectFromRepository(org.apache.maven.artifact.Artifact artifact)
                                                                       throws org.apache.maven.project.ProjectBuildingException
Get the Maven project from the repository depending the Artifact given.

Parameters:
artifact - an artifact
Returns:
the Maven project for the given artifact
Throws:
org.apache.maven.project.ProjectBuildingException - if any

getUnknownLicenseMessage

public static String getUnknownLicenseMessage()

getThirdPartyFilename

public String getThirdPartyFilename()

getOutputDirectory

public File getOutputDirectory()

isForce

public boolean isForce()

isKeepBackup

public boolean isKeepBackup()

isGenerateBundle

public boolean isGenerateBundle()

isDoGenerate

public boolean isDoGenerate()

getBundleThirdPartyPath

public String getBundleThirdPartyPath()

getThirdPartyFile

public File getThirdPartyFile()

getThirdPartyFileContent

public String getThirdPartyFileContent()

setThirdPartyFilename

public void setThirdPartyFilename(String thirdPartyFilename)

setForce

public void setForce(boolean force)

setOutputDirectory

public void setOutputDirectory(File outputDirectory)

setKeepBackup

public void setKeepBackup(boolean keepBackup)

setGenerateBundle

public void setGenerateBundle(boolean generateBundle)

setBundleThirdPartyPath

public void setBundleThirdPartyPath(String bundleThirdPartyPath)

setThirdPartyFileContent

public void setThirdPartyFileContent(String thirdPartyFileContent)

setDoGenerate

public void setDoGenerate(boolean doGenerate)

setThirdPartyFile

public void setThirdPartyFile(File thirdPartyFile)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.