Package org.codehaus.mojo.templating
Class AbstractFilterSourcesMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.codehaus.mojo.templating.AbstractFilterSourcesMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
FilterSourcesMojo,FilterTestSourcesMojo
public abstract class AbstractFilterSourcesMojo extends org.apache.maven.plugin.AbstractMojoThe base class forFilterSourcesMojoandFilterTestSourcesMojo
-
-
Field Summary
Fields Modifier and Type Field Description private static intCHECKSUM_BUFFERprivate intcopiedprotected java.util.List<java.lang.String>delimitersSet of delimiters for expressions to filter within the resources.private java.lang.StringencodingThe character encoding scheme to be applied when filtering resources.protected java.lang.StringescapeStringExpression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}protected org.apache.maven.shared.filtering.MavenResourcesFilteringmavenResourcesFilteringThe resources filtering which is used.protected booleanoverwriteControls whether to overwrite files that are not changed, by default files will not be overwrittenprivate org.apache.maven.project.MavenProjectprojectprivate org.apache.maven.execution.MavenSessionsessionprotected booleanskipPomsSkips POM projects if set to true, which is the default option.protected booleanuseDefaultDelimitersControls whether the default delimiters are included in addition to those configureddelimiters.
-
Constructor Summary
Constructors Constructor Description AbstractFilterSourcesMojo()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddSourceFolderToProject(org.apache.maven.project.MavenProject mavenProject)private voidcleanupTemporaryDirectory(java.io.File temporaryDirectory)private voidclose(java.io.Closeable is)private voidcopyDirectoryStructure(java.io.File sourceDirectory, java.io.File destinationDirectory)private voidcopyDirectoryStructureWithIO(java.io.File sourceDirectory, java.io.File destinationDirectory, java.io.File rootDestinationDirectory)protected intcountCopiedFiles()voidexecute()private voidfilterSourceToTemporaryDir(java.io.File sourceDirectory, java.io.File temporaryDirectory)private longgetCrc32OfFile(java.io.File target)protected abstract java.io.FilegetOutputDirectory()protected abstract java.io.FilegetSourceDirectory()private java.io.FilegetTemporaryDirectory(java.io.File sourceDirectory)private booleanisFileDifferent(java.io.File file, java.io.File directory)private booleanisSomethingBeenUpdated()private voidlogDebug(java.lang.String format, java.lang.Object... args)private voidlogInfo(java.lang.String format, java.lang.Object... args)private voidpreconditionsCopyDirectoryStructure(java.io.File sourceDirectory, java.io.File destinationDirectory, java.io.File rootDestinationDirectory)private booleanpreconditionsFulfilled(java.io.File sourceDirectory)private java.io.Fileresolve(java.io.File file, java.lang.String... subfile)private voidsetDelimitersForExecution(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution)
-
-
-
Field Detail
-
CHECKSUM_BUFFER
private static final int CHECKSUM_BUFFER
- See Also:
- Constant Field Values
-
copied
private int copied
-
encoding
@Parameter(defaultValue="${project.build.sourceEncoding}") private java.lang.String encodingThe character encoding scheme to be applied when filtering resources.
-
escapeString
@Parameter(property="maven.resources.escapeString") protected java.lang.String escapeString
Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}
-
delimiters
@Parameter protected java.util.List<java.lang.String> delimiters
Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end. So, the default filtering delimiters might be specified as:<delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters>Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
-
useDefaultDelimiters
@Parameter(defaultValue="true") protected boolean useDefaultDelimiters
Controls whether the default delimiters are included in addition to those configureddelimiters. Does not have any effect ifdelimitersis empty when the defaults will be included anyway.
-
session
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession session
-
project
@Parameter(defaultValue="${project}", required=true, readonly=true) private org.apache.maven.project.MavenProject project
-
overwrite
@Parameter(defaultValue="false") protected boolean overwrite
Controls whether to overwrite files that are not changed, by default files will not be overwritten
-
skipPoms
@Parameter(defaultValue="true") protected boolean skipPoms
Skips POM projects if set to true, which is the default option.
-
mavenResourcesFiltering
@Component(hint="default") protected org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering
The resources filtering which is used.
-
-
Method Detail
-
getSourceDirectory
protected abstract java.io.File getSourceDirectory()
- Returns:
- The location of the source directory.
-
getOutputDirectory
protected abstract java.io.File getOutputDirectory()
- Returns:
- The location of the output directory.
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
countCopiedFiles
protected int countCopiedFiles()
- Returns:
- number of copied files.
-
logInfo
private void logInfo(java.lang.String format, java.lang.Object... args)
-
logDebug
private void logDebug(java.lang.String format, java.lang.Object... args)
-
isSomethingBeenUpdated
private boolean isSomethingBeenUpdated()
-
cleanupTemporaryDirectory
private void cleanupTemporaryDirectory(java.io.File temporaryDirectory) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
filterSourceToTemporaryDir
private void filterSourceToTemporaryDir(java.io.File sourceDirectory, java.io.File temporaryDirectory) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
setDelimitersForExecution
private void setDelimitersForExecution(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution)
-
preconditionsCopyDirectoryStructure
private void preconditionsCopyDirectoryStructure(java.io.File sourceDirectory, java.io.File destinationDirectory, java.io.File rootDestinationDirectory) throws java.io.IOException- Throws:
java.io.IOException
-
copyDirectoryStructure
private void copyDirectoryStructure(java.io.File sourceDirectory, java.io.File destinationDirectory) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
copyDirectoryStructureWithIO
private void copyDirectoryStructureWithIO(java.io.File sourceDirectory, java.io.File destinationDirectory, java.io.File rootDestinationDirectory) throws java.io.IOException- Throws:
java.io.IOException
-
resolve
private java.io.File resolve(java.io.File file, java.lang.String... subfile)
-
isFileDifferent
private boolean isFileDifferent(java.io.File file, java.io.File directory) throws java.io.IOException- Throws:
java.io.IOException
-
getCrc32OfFile
private long getCrc32OfFile(java.io.File target) throws java.io.IOException- Throws:
java.io.IOException
-
close
private void close(java.io.Closeable is) throws java.io.IOException- Throws:
java.io.IOException
-
getTemporaryDirectory
private java.io.File getTemporaryDirectory(java.io.File sourceDirectory)
-
preconditionsFulfilled
private boolean preconditionsFulfilled(java.io.File sourceDirectory)
-
addSourceFolderToProject
protected abstract void addSourceFolderToProject(org.apache.maven.project.MavenProject mavenProject)
- Parameters:
mavenProject-MavenProject
-
-