org.apache.myfaces.buildtools.maven2.plugin.builder.unpack
Class UnpackMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.AbstractDependencyMojo
          extended by org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.AbstractFromConfigurationMojo
              extended by org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.UnpackMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class UnpackMojo
extends AbstractFromConfigurationMojo

Goal that retrieves a list of artifacts from the repository and unpacks them in a defined location.

This mojo reutilize org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo from maven-dependency-plugin.

The idea of this plugin, instead just unpack a list of artifacts is add some new features necessary to make easier maintain 1.1 and 1.2 code on myfaces projects like tomahawk.

This plugin works as unpack goal of maven-dependency-plugin with 2 additional enhancements:

  1. If some file exists on the base directories, it is added as excluded, so it is not copied to the output directory. This makes easier to manage the code and maintain it.
  2. If a file is generated from the model (reading the myfaces-metadata.xml) it is not copied, since this should be generated again.

Since:
1.0
Version:
$Id: UnpackMojo.java 1067554 2011-02-06 00:33:43Z lu4242 $
Author:
Leonardo Uribe

Field Summary
 
Fields inherited from class org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.AbstractDependencyMojo
archiverManager, artifactCollector, artifactMetadataSource, factory, local, outputAbsoluteArtifactFilename, project, reactorProjects, remoteRepos, resolver, silent
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
UnpackMojo()
           
 
Method Summary
protected  void addExcludes(String basePath, File f, List exclusions)
           
 void execute()
          Main entry into mojo.
 String getExcludes()
           
 String getIncludes()
           
 File getMarkersDirectory()
           
protected  ArrayList getProcessedArtifactItems(boolean removeVersion)
          Preprocesses the list of ArtifactItems.
protected  String scanAndAddExistingFilesAsExcluded(File dir1, File dir2)
          This method scan on both directories and add all files as excluded files to be unpacked.
protected  String scanModelAndAddGeneratedFiles(ArtifactItem artifactItem)
           
 void setExcludes(String excludes)
           
 void setIncludes(String includes)
           
 void setMarkersDirectory(File theMarkersDirectory)
           
 
Methods inherited from class org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.AbstractFromConfigurationMojo
getArtifact, getArtifactItems, getOutputDirectory, isOverWriteIfNewer, isOverWriteReleases, isOverWriteSnapshots, setArtifactItems, setOutputDirectory, setOverWriteIfNewer, setOverWriteReleases, setOverWriteSnapshots
 
Methods inherited from class org.apache.myfaces.buildtools.maven2.plugin.builder.unpack.AbstractDependencyMojo
copyFile, getArchiverManager, getArtifactCollector, getArtifactMetadataSource, getFactory, getLocal, getLog, getProject, getRemoteRepos, getResolver, setArchiverManager, setArtifactCollector, setArtifactMetadataSource, setFactory, setLocal, setRemoteRepos, setResolver, unpack, unpack
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnpackMojo

public UnpackMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Main entry into mojo. This method gets the ArtifactItems and iterates through each one passing it to unpackArtifact.

Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.
See Also:
ArtifactItem, AbstractFromConfigurationMojo.getArtifactItems(), unpackArtifact(ArtifactItem)

getProcessedArtifactItems

protected ArrayList getProcessedArtifactItems(boolean removeVersion)
                                       throws org.apache.maven.plugin.MojoExecutionException
Description copied from class: AbstractFromConfigurationMojo
Preprocesses the list of ArtifactItems. This method defaults the outputDirectory if not set and creates the output Directory if it doesn't exist.

Overrides:
getProcessedArtifactItems in class AbstractFromConfigurationMojo
Parameters:
removeVersion - remove the version from the filename.
Returns:
An ArrayList of preprocessed ArtifactItems
Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs.
See Also:
ArtifactItem

scanModelAndAddGeneratedFiles

protected String scanModelAndAddGeneratedFiles(ArtifactItem artifactItem)
                                        throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

scanAndAddExistingFilesAsExcluded

protected String scanAndAddExistingFilesAsExcluded(File dir1,
                                                   File dir2)
This method scan on both directories and add all files as excluded files to be unpacked. Return the resulting filter.

Parameters:
exclusions -
dir1 -
dir2 -
Returns:

addExcludes

protected void addExcludes(String basePath,
                           File f,
                           List exclusions)

getMarkersDirectory

public File getMarkersDirectory()
Returns:
Returns the markersDirectory.

setMarkersDirectory

public void setMarkersDirectory(File theMarkersDirectory)
Parameters:
theMarkersDirectory - The markersDirectory to set.

getExcludes

public String getExcludes()
Returns:
Returns a comma separated list of excluded items

setExcludes

public void setExcludes(String excludes)
Parameters:
excludes - A comma separated list of items to exclude i.e. **\/*.xml, **\/*.properties

getIncludes

public String getIncludes()
Returns:
Returns a comma separated list of included items

setIncludes

public void setIncludes(String includes)
Parameters:
includes - A comma separated list of items to include i.e. **\/*.xml, **\/*.properties


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.