org.nuiton.license.plugin
Class UpdateProjectLicenseMojo

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.AbstractLicenseNameMojo
                  extended by org.nuiton.license.plugin.UpdateProjectLicenseMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.nuiton.plugin.Plugin, org.nuiton.plugin.PluginWithEncoding

public class UpdateProjectLicenseMojo
extends AbstractLicenseNameMojo

Updates (or creates) the main project license file according to the given license defines as AbstractLicenseNameMojo.licenseName.

Can also generate a bundled license file (to avoid collision names in class-path). This file is by default generated in META-INF class-path directory.

Note: this goal replace add-license one (which does not use license project descriptor).

Since:
2.1
Author:
tchemit
Is defined by the goal name:
update-project-license
Is bound to the specified phase of the standard build lifecycle:
generate-resources
Requires a Maven project to run:
true

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
org.nuiton.plugin.Plugin.InitState, org.nuiton.plugin.Plugin.Packaging
 
Field Summary
protected  String bundleLicensePath
          The path of the bundled license file to produce when generateBundle is on.
protected  boolean doGenerate
          flag to known if
protected  boolean force
          A flag to force to generate project license file even if it is up-to-date.
protected  boolean generateBundle
          A flag to copy the main license file in a bundled place.
protected  File licenseFile
          Project license file to synchronize with main license defined in descriptor file.
protected  File outputDirectory
          The directory where to generate license resources.
protected  boolean skipUpdateProjectLicense
          A flag to skip the goal.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
UpdateProjectLicenseMojo()
           
 
Method Summary
protected  void doAction()
           
 String getBundleLicensePath()
           
 File getLicenseFile()
           
 File getOutputDirectory()
           
protected  void init()
           
 boolean isDoGenerate()
           
 boolean isForce()
           
 boolean isGenerateBundle()
           
 boolean isSkip()
          When is sets to true, will skip execution.
 void setBundleLicensePath(String bundleLicensePath)
           
 void setDoGenerate(boolean doGenerate)
           
 void setForce(boolean force)
           
 void setGenerateBundle(boolean generateBundle)
           
 void setLicenseFile(File licenseFile)
           
 void setOutputDirectory(File outputDirectory)
           
 void setSkip(boolean skipUpdateProjectLicense)
          Changes internal state skip to execute (or not) goal.
 
Methods inherited from class org.nuiton.license.plugin.AbstractLicenseNameMojo
checkLicense, checkSkip, getEncoding, getLicense, getLicenseName, getLicenseResolver, getLicenseStore, getMainLicense, isKeepBackup, setEncoding, setKeepBackup, setLicenseName, setLicenseResolver, setLicenseStore
 
Methods inherited from class org.nuiton.license.plugin.AbstractLicenseMojo
createLicenseStore, getBuildTimestamp, getProject, getSession, isVerbose, setProject, setSession, setVerbose
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, 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.nuiton.plugin.Plugin
getProject, isVerbose, setProject, setVerbose
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute, getLog, setLog
 

Field Detail

licenseFile

protected File licenseFile
Project license file to synchronize with main license defined in descriptor file.

Since:
2.1
Is defined by:
expression:
${license.licenceFile}
default-value:
${basedir}/LICENSE.txt
Is required.

outputDirectory

protected File outputDirectory
The directory where to generate license resources.

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

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

generateBundle

protected boolean generateBundle
A flag to copy the main license file in a bundled place.

This is usefull for final application to have a none confusing location to seek for the application license.

If Sets to true, will copy the license file to the bundleLicensePath to outputDirectory.

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

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

bundleLicensePath

protected String bundleLicensePath
The path of the bundled license file to produce when generateBundle is on.

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

Since:
2.1
Is defined by:
expression:
${license.bundleLicensePath}
default-value:
META-INF/${project.artifactId}-LICENSE.txt

force

protected boolean force
A flag to force to generate project license file even if it is up-to-date.

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

skipUpdateProjectLicense

protected boolean skipUpdateProjectLicense
A flag to skip the goal.

Since:
2.1
Is defined by:
expression:
${license.skipUpdateProjectLicense}
default-value:
false

doGenerate

protected boolean doGenerate
flag to known if

Constructor Detail

UpdateProjectLicenseMojo

public UpdateProjectLicenseMojo()
Method Detail

init

protected void init()
             throws Exception
Overrides:
init in class AbstractLicenseNameMojo
Throws:
Exception

doAction

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

getLicenseFile

public File getLicenseFile()

isGenerateBundle

public boolean isGenerateBundle()

getOutputDirectory

public File getOutputDirectory()

getBundleLicensePath

public String getBundleLicensePath()

isDoGenerate

public boolean isDoGenerate()

isForce

public boolean isForce()

isSkip

public boolean isSkip()
Description copied from class: AbstractLicenseNameMojo
When is sets to true, will skip execution.

This will take effects in method AbstractLicenseNameMojo.checkSkip(). So the method AbstractPlugin.doAction() will never be invoked.

Specified by:
isSkip in class AbstractLicenseNameMojo
Returns:
true if goal will not be executed

setLicenseFile

public void setLicenseFile(File licenseFile)

setGenerateBundle

public void setGenerateBundle(boolean generateBundle)

setOutputDirectory

public void setOutputDirectory(File outputDirectory)

setBundleLicensePath

public void setBundleLicensePath(String bundleLicensePath)

setDoGenerate

public void setDoGenerate(boolean doGenerate)

setSkip

public void setSkip(boolean skipUpdateProjectLicense)
Description copied from class: AbstractLicenseNameMojo
Changes internal state skip to execute (or not) goal.

Specified by:
setSkip in class AbstractLicenseNameMojo
Parameters:
skipUpdateProjectLicense - new state value

setForce

public void setForce(boolean force)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.