Conversation
…S-232)
Add a new `outputEncoding` plugin parameter that configures the charset used
to write filtered resources. When set, the plugin reads files with `encoding`
(input) and writes them with `outputEncoding` (output), enabling lossless
encoding conversion during the build.
Use case: converting EBCDIC/Latin-1 legacy source trees to UTF-8 output
without manually converting the source files.
Configuration:
<configuration>
<encoding>ISO-8859-1</encoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
Or as a CLI property:
-Dmaven.resources.outputEncoding=UTF-8
Per-resource encoding override is also supported via `<encoding>` and
`<outputEncoding>` inside `<resource>` blocks (requires maven-filtering
4.0.0-beta-3-SNAPSHOT or later once released).
This parameter only applies to filtered resources (filtering=true). Non-filtered
files are always copied as raw bytes, so encoding is irrelevant for them.
NOTE: pom.xml bumped to maven-filtering 4.0.0-beta-2-SNAPSHOT (local dev only;
will be updated to released version before merge).
Relates to apache/maven-filtering (output-encoding PR)
gnodet-bot
reviewed
Sep 25, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
Clean feature addition — well-structured parameter, good Javadoc, solid IT with both string and byte-level verification. One inaccuracy to fix on the @since tag.
The SNAPSHOT dependency on maven-filtering 4.0.0-beta-2-SNAPSHOT is acknowledged in the PR description and expected to be updated before merge.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
| * as raw bytes. | ||
| * </p> | ||
| * | ||
| * @since 3.4.1 |
There was a problem hiding this comment.
@since tag — version 3.4.1 was never released (releases went 3.4.0 → 3.5.0 → 3.5.1). Since this PR targets master (the 4.x line), this should be:
Suggested change
| * @since 3.4.1 | |
| * @since 4.0.0-beta-2 |
If backporting to the 3.x line as well, use the future 3.x release version there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
outputEncodingplugin parameter that configures the character encoding used to write filtered resources. When set, the plugin reads source files withencodingand writes filtered output withoutputEncoding, enabling lossless encoding conversion during the build.Closes #335
Companion filtering PR: apache/maven-filtering#407
Use case
Converting a legacy EBCDIC or Latin-1 (ISO-8859-1) source tree to UTF-8 output without manually converting the source files:
Or as a CLI property:
-Dmaven.resources.outputEncoding=UTF-8Per-resource encoding override via
<encoding>/<outputEncoding>inside a<resource>block is also supported (requires the companion filtering PR to be released first).Notes
<filtering>true</filtering>). Non-filtered files are always copied as raw bytes — encoding is irrelevant for them.outputEncodingis not set (the default), the same encoding is used for reading and writing, preserving full backward compatibility.pom.xmlreferencesmaven-filtering 4.0.0-beta-2-SNAPSHOTfor local build; will be updated to the released version once the companion PR is merged and released.Changes
ResourcesMojo: new@Parameter outputEncodingfield wired intoMavenResourcesExecution.setOutputEncoding()src/it/MRESOURCES-232/: IT with a Latin-1 source file containing a filter token and an é character; verifies the output file is UTF-8-encoded with the token expanded and é surviving as0xC3 0xA9Closes #335