Interface MavenFileFilter

All Superinterfaces:
DefaultFilterInfo
All Known Implementing Classes:
DefaultMavenFileFilter

public interface MavenFileFilter extends DefaultFilterInfo
Author:
Olivier Lamy
  • Method Details

    • copyFile

      void copyFile(Path from, Path to, boolean filtering, org.apache.maven.api.Project mavenProject, List<String> filters, boolean escapedBackslashesInFilePath, String encoding, org.apache.maven.api.Session mavenSession) throws MavenFilteringException
      Will copy a file with some filtering using defaultFilterWrappers.
      Parameters:
      from - file to copy/filter
      to - destination file
      filtering - enable or not filtering
      mavenProject - Project
      filters - List of String which are path to a Property file
      escapedBackslashesInFilePath - escape backslashes in file path.
      encoding - The encoding which is used during the filtering process.
      mavenSession - Session
      Throws:
      MavenFilteringException - in case of failure.
      See Also:
    • copyFile

      void copyFile(MavenFileFilterRequest mavenFileFilterRequest) throws MavenFilteringException
      Parameters:
      mavenFileFilterRequest - the request
      Throws:
      MavenFilteringException - in case of failure.
      Since:
      1.0-beta-3
    • copyFile

      @Deprecated void copyFile(Path from, Path to, boolean filtering, List<FilterWrapper> filterWrappers, String encoding) throws MavenFilteringException
      Parameters:
      from - The source file
      to - The target file
      filtering - true to apply filtering
      filterWrappers - List of FileUtils.FilterWrapper
      encoding - The encoding used during the filtering.
      Throws:
      MavenFilteringException - In case of an error.
    • copyFile

      void copyFile(Path from, Path to, boolean filtering, List<FilterWrapper> filterWrappers, String encoding, ChangeDetection changeDetection) throws MavenFilteringException
      Parameters:
      from - The source file
      to - The target file
      filtering - true to apply filtering
      filterWrappers - The filters to be applied.
      encoding - The encoding to use
      changeDetection - The change detection mode to use to determine if the file should be copied/filtered.
      Throws:
      MavenFilteringException - In case of an error.
      Since:
      4.0.0-beta-2
    • copyFileWithResult

      boolean copyFileWithResult(Path from, Path to, boolean filtering, List<FilterWrapper> filterWrappers, String encoding, ChangeDetection changeDetection) throws MavenFilteringException
      Copies (or filters) a file and returns whether the destination was actually written.

      This method is identical to copyFile(Path, Path, boolean, List, String, ChangeDetection) but returns true when the destination file was created or updated, and false when the change-detection strategy determined the destination was already up to date and therefore left untouched. Callers can use this to emit accurate log messages (e.g. "Copying" vs "Skipping (up to date)").

      Parameters:
      from - The source file
      to - The target file
      filtering - true to apply filtering
      filterWrappers - The filters to be applied.
      encoding - The encoding to use
      changeDetection - The change detection mode to use to determine if the file should be copied/filtered.
      Returns:
      true if the destination was written; false if it was skipped.
      Throws:
      MavenFilteringException - In case of an error.
      Since:
      4.0.0-beta-2
    • copyFile

      default void copyFile(Path from, Path to, boolean filtering, List<FilterWrapper> filterWrappers, String encoding, boolean gracefulBinaryHandling) throws MavenFilteringException
      Parameters:
      from - The source file
      to - The target file
      filtering - true to apply filtering
      filterWrappers - List of FileUtils.FilterWrapper
      encoding - The encoding used during the filtering.
      gracefulBinaryHandling - when true, files that cause MalformedInputException are copied as-is with a warning instead of failing the build
      Throws:
      MavenFilteringException - In case of an error.
      Since:
      3.4.0
    • copyFileWithResult

      boolean copyFileWithResult(Path from, Path to, boolean filtering, List<FilterWrapper> filterWrappers, String inputEncoding, String outputEncoding, ChangeDetection changeDetection) throws MavenFilteringException
      Copy and optionally filter a file using separate input and output encodings. This enables encoding conversion during resource filtering (e.g. reading ISO-8859-1 and writing UTF-8).
      Parameters:
      from - The source file
      to - The target file
      filtering - true to apply filtering
      filterWrappers - List of FileUtils.FilterWrapper
      inputEncoding - The charset used to read from
      outputEncoding - The charset used to write to
      changeDetection - The change detection mode to use
      Returns:
      true if the destination was written; false if it was skipped.
      Throws:
      MavenFilteringException - In case of an error.
      Since:
      4.0.0-beta-3