org.nuiton.helper.plugin
Class CollectFilesMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.nuiton.plugin.AbstractPlugin
          extended by org.nuiton.helper.plugin.CollectFilesMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, Plugin

public class CollectFilesMojo
extends AbstractPlugin

Collect files some files from a project and copy them into a directory.

Since:
1.1.0
Author:
tchemit
Is defined by the goal name:
collect-files
Requires a Maven project to run:
true

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.plugin.Plugin
Plugin.InitState, Plugin.Packaging
 
Field Summary
protected  org.apache.maven.artifact.Artifact artifact
          Project artifact.
protected  List attachedArtifacts
          The artifacts to publish from the project build.
protected  boolean copyFiles
          Un flag pour recopier les fichiers collectés.
protected  org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository
          The remote repository.
protected  String descriptionFile
          File with all files collected (one file by line in absolute path).
protected  boolean dryRun
          Un flag pour activer le mode verbeux.
protected  String encoding
          Encoding a utiliser pour lire et ecrire les fichiers.
protected  String excludes
          File name pattern of selected files to publish.
protected  String extraFiles
          User extra files to collect.
protected  List<File> files
          Files to collect
protected  boolean includeAttached
          Un flag pour collecter aussi les fichiers attaches au projet.
protected  String includes
          File name pattern of selected files to publish.
protected  boolean includeSiteAttached
          Un flag pour collecter aussi les fichiers des sites attaches au projet.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          The local repository.
protected  String outputDirectory
          Directory where to store collected files.
protected  org.apache.maven.project.MavenProject project
          Dependance du projet.
protected  boolean skip
          A flag to skip the goal.
protected  boolean verbose
          Un flag pour activer le mode verbeux.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CollectFilesMojo()
           
 
Method Summary
protected  void addFile(File f, String msg, List<File> files, Pattern includePattern, Pattern excludePattern)
           
protected  boolean checkSkip()
          Checks if the mojo execution should be skipped.
 void doAction()
          Do plugin action.
protected  org.apache.maven.project.MavenProject getExecutionRootProject()
           
protected  List<File> getFiles()
           
 List<File> getFiles(File input)
          Read a file containing on each line the path of a file.
 org.apache.maven.project.MavenProject getProject()
           
protected  void init()
          Method to initialize the mojo before doing any concrete actions.
 boolean isVerbose()
           
 void setFiles(File output, List<File> files)
          Save the list of files in the given output file.
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setVerbose(boolean verbose)
           
 
Methods inherited from class org.nuiton.plugin.AbstractPlugin
acceptPackaging, addCompileSourceRoots, addDirectoryToUrlsList, addResourceDir, addTestCompileSourceRoots, addTestResourceDir, addUrlToUrlsList, afterExecute, backupFile, checkPackaging, checkResource, checkRunOnceDone, 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

project

protected org.apache.maven.project.MavenProject project
Dependance du projet.

Since:
1.0.3
Is defined by:
default-value:
${project}
Is readonly.
Is required.

attachedArtifacts

protected List attachedArtifacts
The artifacts to publish from the project build.

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

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
The local repository.

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

deploymentRepository

protected org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository
The remote repository.

Since:
1.2.2
Is defined by:
expression:
${project.distributionManagementArtifactRepository}
Is readonly.
Is required.

artifact

protected org.apache.maven.artifact.Artifact artifact
Project artifact.

Since:
1.2.2
Is defined by:
expression:
${project.artifact}
Is readonly.
Is required.

extraFiles

protected String extraFiles
User extra files to collect.

Multi values can be used, separated by comma.

Since:
1.0.0
Is defined by:
expression:
${helper.extraFiles}

includes

protected String includes
File name pattern of selected files to publish.

If no Set - no include filter

Since:
1.0.0
Is defined by:
expression:
${helper.includes}
default-value:

excludes

protected String excludes
File name pattern of selected files to publish.

If no Set - no exclude filter

Since:
1.0.0
Is defined by:
expression:
${helper.excludes}
default-value:

outputDirectory

protected String outputDirectory
Directory where to store collected files.

Note : In a multi-module context, will always use the value of the property of the root module, because we need to push collected files to only one place.

Since:
1.0.0
Is defined by:
expression:
${helper.outputDirectory}
default-value:
target/collect

descriptionFile

protected String descriptionFile
File with all files collected (one file by line in absolute path).

Note : If not Set, will not generate the description file.

Since:
1.0.0
Is defined by:
expression:
${helper.descriptionFile}

includeAttached

protected boolean includeAttached
Un flag pour collecter aussi les fichiers attaches au projet.

Since:
1.0.0
Is defined by:
expression:
${helper.includeAttached}
default-value:
true

includeSiteAttached

protected boolean includeSiteAttached
Un flag pour collecter aussi les fichiers des sites attaches au projet.

Since:
1.2.2
Is defined by:
expression:
${helper.includeSiteAttached}
default-value:
false

copyFiles

protected boolean copyFiles
Un flag pour recopier les fichiers collectés.

Since:
1.0.0
Is defined by:
expression:
${helper.copyFiles}
default-value:
true

verbose

protected boolean verbose
Un flag pour activer le mode verbeux.

Since:
1.0.0
Is defined by:
expression:
${helper.verbose}
default-value:
${maven.verbose}

skip

protected boolean skip
A flag to skip the goal.

Since:
1.0.0
Is defined by:
expression:
${helper.skip}
default-value:
false

dryRun

protected boolean dryRun
Un flag pour activer le mode verbeux.

Since:
1.0.0
Is defined by:
expression:
${helper.dryRun}
default-value:
false

encoding

protected String encoding
Encoding a utiliser pour lire et ecrire les fichiers.

Since:
1.0.0
Is defined by:
expression:
${helper.encoding}
default-value:
${project.build.sourceEncoding}
Is required.

files

protected List<File> files
Files to collect

Constructor Detail

CollectFilesMojo

public CollectFilesMojo()
Method Detail

init

protected void init()
             throws Exception
Description copied from class: AbstractPlugin
Method to initialize the mojo before doing any concrete actions.

Note: The method is invoked before the AbstractPlugin.doAction() method.

Specified by:
init in class AbstractPlugin
Throws:
Exception - if any

checkSkip

protected boolean checkSkip()
Description copied from class: AbstractPlugin
Checks if the mojo execution should be skipped.

Overrides:
checkSkip in class AbstractPlugin
Returns:
false if the mojo should not be executed.

doAction

public void doAction()
              throws Exception
Description copied from class: AbstractPlugin
Do plugin action.

The method AbstractPlugin.execute() invoke this method only and only if :

Specified by:
doAction in class AbstractPlugin
Throws:
Exception - if any

getFiles

public List<File> getFiles(File input)
                    throws IOException
Read a file containing on each line the path of a file.

Parameters:
input - the file containing the list of files
Returns:
the list of files read from the given file
Throws:
IOException - if any pb while reading file

setFiles

public void setFiles(File output,
                     List<File> files)
              throws IOException
Save the list of files in the given output file.

Each line is the absolute path of each files of the list

Parameters:
output - the file when to write
files - the files to store
Throws:
IOException - if any pb when writing file

getFiles

protected List<File> getFiles()

getExecutionRootProject

protected org.apache.maven.project.MavenProject getExecutionRootProject()

addFile

protected void addFile(File f,
                       String msg,
                       List<File> files,
                       Pattern includePattern,
                       Pattern excludePattern)

getProject

public org.apache.maven.project.MavenProject getProject()

isVerbose

public boolean isVerbose()

setProject

public void setProject(org.apache.maven.project.MavenProject project)

setVerbose

public void setVerbose(boolean verbose)


Copyright © 2009-2010 CodeLutin. All Rights Reserved.