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.AbstractMojo
The base class for
FilterSourcesMojo
and FilterTestSourcesMojo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.sonatype.plexus.build.incremental.BuildContext
private static final int
private int
Set of delimiters for expressions to filter within the resources.private String
The character encoding scheme to be applied when filtering resources.protected String
Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo}protected org.apache.maven.shared.filtering.MavenResourcesFiltering
The resources filtering which is used.protected boolean
Controls whether to overwrite files that are not changed, by default files will not be overwrittenprivate org.apache.maven.project.MavenProject
private org.apache.maven.execution.MavenSession
protected boolean
Skips POM projects if set to true, which is the default option.protected boolean
Controls whether the default delimiters are included in addition to those configureddelimiters
.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addSourceFolderToProject
(org.apache.maven.project.MavenProject mavenProject) private void
cleanupTemporaryDirectory
(File temporaryDirectory) private void
private void
copyDirectoryStructure
(File sourceDirectory, File destinationDirectory) private void
copyDirectoryStructureWithIO
(File sourceDirectory, File destinationDirectory, File rootDestinationDirectory) protected int
void
execute()
private void
filterSourceToTemporaryDir
(File sourceDirectory, File temporaryDirectory) private long
getCrc32OfFile
(File target) protected abstract File
protected abstract File
private File
getTemporaryDirectory
(File sourceDirectory) private boolean
isFileDifferent
(File file, File directory) private boolean
private void
private void
private void
preconditionsCopyDirectoryStructure
(File sourceDirectory, File destinationDirectory, File rootDestinationDirectory) private boolean
preconditionsFulfilled
(File sourceDirectory) private File
private void
setDelimitersForExecution
(org.apache.maven.shared.filtering.MavenResourcesExecution mavenResourcesExecution) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
CHECKSUM_BUFFER
private static final int CHECKSUM_BUFFER- See Also:
-
copied
private int copied -
buildContext
@Component private org.sonatype.plexus.build.incremental.BuildContext buildContext -
encoding
The character encoding scheme to be applied when filtering resources. -
escapeString
Expression preceded with the String won't be interpolated \${foo} will be replaced with ${foo} -
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 useDefaultDelimitersControls whether the default delimiters are included in addition to those configureddelimiters
. Does not have any effect ifdelimiters
is 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 overwriteControls whether to overwrite files that are not changed, by default files will not be overwritten -
skipPoms
@Parameter(defaultValue="true") protected boolean skipPomsSkips POM projects if set to true, which is the default option. -
mavenResourcesFiltering
@Component(hint="default") protected org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFilteringThe resources filtering which is used.
-
-
Constructor Details
-
AbstractFilterSourcesMojo
public AbstractFilterSourcesMojo()
-
-
Method Details
-
getSourceDirectory
- Returns:
- The location of the source directory.
-
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
-
logDebug
-
isSomethingBeenUpdated
private boolean isSomethingBeenUpdated() -
cleanupTemporaryDirectory
private void cleanupTemporaryDirectory(File temporaryDirectory) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
filterSourceToTemporaryDir
private void filterSourceToTemporaryDir(File sourceDirectory, File temporaryDirectory) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
preconditionsCopyDirectoryStructure
private void preconditionsCopyDirectoryStructure(File sourceDirectory, File destinationDirectory, File rootDestinationDirectory) throws IOException - Throws:
IOException
-
copyDirectoryStructure
private void copyDirectoryStructure(File sourceDirectory, File destinationDirectory) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
copyDirectoryStructureWithIO
private void copyDirectoryStructureWithIO(File sourceDirectory, File destinationDirectory, File rootDestinationDirectory) throws IOException - Throws:
IOException
-
resolve
-
isFileDifferent
- Throws:
IOException
-
getCrc32OfFile
- Throws:
IOException
-
close
- Throws:
IOException
-
getTemporaryDirectory
private File getTemporaryDirectory(File sourceDirectory) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
preconditionsFulfilled
-
addSourceFolderToProject
protected abstract void addSourceFolderToProject(org.apache.maven.project.MavenProject mavenProject) - Parameters:
mavenProject
-MavenProject
-