Class ResourceFilteringStrategy

java.lang.Object
org.apache.maven.cling.invoker.mvnup.goals.AbstractUpgradeStrategy
org.apache.maven.cling.invoker.mvnup.goals.ResourceFilteringStrategy
All Implemented Interfaces:
UpgradeStrategy

@Named @Singleton @Priority(17) public class ResourceFilteringStrategy extends AbstractUpgradeStrategy
Strategy for adding binary file extension exclusions to the maven-resources-plugin when resource filtering is enabled.

Maven 4 strictly decodes filtered resources as UTF-8, which causes MalformedInputException when binary files (e.g., .xlsx, .docx) are present in a resource directory with <filtering>true</filtering>. Maven 3 was more lenient and silently handled these files.

This strategy scans all <resource> and <testResource> blocks. If any resource directory has filtering enabled and the maven-resources-plugin does not already declare <nonFilteredFileExtensions>, this strategy adds a list of common binary file extensions to prevent the exception.

See Also:
  • Constructor Details

    • ResourceFilteringStrategy

      public ResourceFilteringStrategy()
  • Method Details

    • isApplicable

      public boolean isApplicable(UpgradeContext context)
      Description copied from interface: UpgradeStrategy
      Checks if this strategy is applicable given the current options.
      Parameters:
      context - the upgrade context
      Returns:
      true if this strategy should be applied
    • getDescription

      public String getDescription()
      Description copied from interface: UpgradeStrategy
      Gets a description of what this strategy does.
      Returns:
      a human-readable description of the strategy
    • doApply

      protected UpgradeResult doApply(UpgradeContext context, Map<Path, eu.maveniverse.domtrip.Document> pomMap)
      Description copied from class: AbstractUpgradeStrategy
      Subclasses implement the actual upgrade logic here.
      Specified by:
      doApply in class AbstractUpgradeStrategy
      Parameters:
      context - the upgrade context
      pomMap - map of all POM files in the project
      Returns:
      the result of the upgrade operation