Class CollectFilesMojo

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

@Mojo(name="collect-files", requiresProject=true) public class CollectFilesMojo extends org.nuiton.plugin.AbstractPlugin implements org.nuiton.plugin.PluginWithEncoding
Collect files some files from a project and copy them into a directory.
Since:
1.1.0
Author:
Tony Chemit - chemit@codelutin.com
  • 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

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.maven.artifact.Artifact
    Project artifact.
    protected List<?>
    The artifacts to publish from the project build.
    protected boolean
    Un flag pour recopier les fichiers collectés.
    protected org.apache.maven.artifact.repository.ArtifactRepository
    The remote repository.
    protected String
    File with all files collected (one file by line in absolute path).
    protected boolean
    Un flag pour activer le mode verbeux.
    protected String
    Encoding a utiliser pour lire et ecrire les fichiers.
    protected String
    File name pattern of selected files to publish.
    protected String
    User extra files to collect.
    protected List<File>
    Files to collect
    protected boolean
    Un flag pour collecter aussi les fichiers attaches au projet.
    protected String
    File name pattern of selected files to publish.
    protected boolean
    Un flag pour collecter aussi les fichiers des sites attaches au projet.
    protected org.apache.maven.artifact.repository.ArtifactRepository
    The local repository.
    protected String
    Directory where to store collected files.
    protected org.apache.maven.project.MavenProject
    Fallback maven project (for maven 2).
    protected List<?>
    The projects in the reactor.
    protected boolean
    A flag to skip the goal.
    protected boolean
    Un flag pour activer le mode verbeux.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addFile(File f, String msg, List<File> files, Pattern includePattern, Pattern excludePattern)
     
    protected boolean
     
    void
     
     
    protected List<File>
     
    getFiles(File input)
    Read a file containing on each line the path of a file.
    org.apache.maven.project.MavenProject
     
    protected void
     
    boolean
     
    void
    setEncoding(String encoding)
     
    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, checkEncoding, checkPackaging, checkResource, checkRunOnceDone, copyFile, createDirectoryIfNecessary, createNewFile, deleteFile, execute, getBackupFile, getFileFromBasedir, getFilesToTreate, getFilesToTreateForRoots, getRootProject, getTemplate, hasClassPath, initClassLoader, isExecutionRoot, isFileNewerThanPomFile, needInvoke, needInvoke, rejectPackaging, removeCompileSourceRoots, removeTestCompileSourceRoots, renameFile, writeFile

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.plugin.Mojo

    execute, getLog, setLog
  • Field Details

    • reactorProjects

      @Parameter(property="reactorProjects", readonly=true, required=true) protected List<?> reactorProjects
      The projects in the reactor.
      Since:
      1.2.4
    • project

      @Parameter(defaultValue="${project}", required=true, readonly=true) protected org.apache.maven.project.MavenProject project
      Fallback maven project (for maven 2).
      Since:
      1.0.3
    • attachedArtifacts

      @Parameter(property="project.attachedArtifacts", readonly=true, required=true) protected List<?> attachedArtifacts
      The artifacts to publish from the project build.
      Since:
      1.0.0
    • localRepository

      @Parameter(property="localRepository", readonly=true, required=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      The local repository.
      Since:
      1.2.2
    • deploymentRepository

      @Parameter(property="project.distributionManagementArtifactRepository", readonly=true, required=true) protected org.apache.maven.artifact.repository.ArtifactRepository deploymentRepository
      The remote repository.
      Since:
      1.2.2
    • artifact

      @Parameter(property="project.artifact", readonly=true, required=true) protected org.apache.maven.artifact.Artifact artifact
      Project artifact.
      Since:
      1.2.2
    • extraFiles

      @Parameter(property="helper.extraFiles") protected String extraFiles
      User extra files to collect. Multi values can be used, separated by comma.
      Since:
      1.0.0
    • includes

      @Parameter(property="helper.includes", defaultValue="") protected String includes
      File name pattern of selected files to publish. If no Set - no include filter
      Since:
      1.0.0
    • excludes

      @Parameter(property="helper.excludes", defaultValue="") protected String excludes
      File name pattern of selected files to publish. If no Set - no exclude filter
      Since:
      1.0.0
    • outputDirectory

      @Parameter(property="helper.outputDirectory", defaultValue="target/collect") 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
    • descriptionFile

      @Parameter(property="helper.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
    • includeAttached

      @Parameter(property="helper.includeAttached", defaultValue="true") protected boolean includeAttached
      Un flag pour collecter aussi les fichiers attaches au projet.
      Since:
      1.0.0
    • includeSiteAttached

      @Parameter(property="helper.includeSiteAttached", defaultValue="false") protected boolean includeSiteAttached
      Un flag pour collecter aussi les fichiers des sites attaches au projet.
      Since:
      1.2.2
    • copyFiles

      @Parameter(property="helper.copyFiles", defaultValue="true") protected boolean copyFiles
      Un flag pour recopier les fichiers collectés.
      Since:
      1.0.0
    • verbose

      @Parameter(property="helper.verbose", defaultValue="${maven.verbose}") protected boolean verbose
      Un flag pour activer le mode verbeux.
      Since:
      1.0.0
    • skip

      @Parameter(property="helper.skip", defaultValue="false") protected boolean skip
      A flag to skip the goal.
      Since:
      1.0.0
    • dryRun

      @Parameter(property="helper.dryRun", defaultValue="false") protected boolean dryRun
      Un flag pour activer le mode verbeux.
      Since:
      1.0.0
    • encoding

      @Parameter(property="helper.encoding", defaultValue="${project.build.sourceEncoding}", required=true) protected String encoding
      Encoding a utiliser pour lire et ecrire les fichiers.
      Since:
      1.0.0
    • files

      protected List<File> files
      Files to collect
  • Constructor Details

    • CollectFilesMojo

      public CollectFilesMojo()
  • Method Details

    • init

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

      protected boolean checkSkip()
      Overrides:
      checkSkip in class org.nuiton.plugin.AbstractPlugin
    • doAction

      public void doAction() throws Exception
      Specified by:
      doAction in class org.nuiton.plugin.AbstractPlugin
      Throws:
      Exception
    • 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 where to pick files (one file per line).
      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()
    • addFile

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

      public org.apache.maven.project.MavenProject getProject()
      Specified by:
      getProject in interface org.nuiton.plugin.Plugin
    • isVerbose

      public boolean isVerbose()
      Specified by:
      isVerbose in interface org.nuiton.plugin.Plugin
    • setProject

      public void setProject(org.apache.maven.project.MavenProject project)
      Specified by:
      setProject in interface org.nuiton.plugin.Plugin
    • setVerbose

      public void setVerbose(boolean verbose)
      Specified by:
      setVerbose in interface org.nuiton.plugin.Plugin
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in interface org.nuiton.plugin.PluginWithEncoding
    • setEncoding

      public void setEncoding(String encoding)
      Specified by:
      setEncoding in interface org.nuiton.plugin.PluginWithEncoding