Skip to content

Fix compatibility with Maven Core 4.1.0-SNAPSHOT#991

Closed
desruisseaux wants to merge 2 commits intoapache:masterfrom
Geomatys:fix/filenames-between-quotes
Closed

Fix compatibility with Maven Core 4.1.0-SNAPSHOT#991
desruisseaux wants to merge 2 commits intoapache:masterfrom
Geomatys:fix/filenames-between-quotes

Conversation

@desruisseaux
Copy link
Contributor

@desruisseaux desruisseaux commented Nov 10, 2025

Edit: a previous version of this pull request wrongly said that this issue exists since Maven core 4.0.0-rc-5. However after verification, it seems that apache/maven#2505 has never been ported to the 4.0.x branch.

Since Maven core 4.1.0-SNAPSHOT, options formatted by JavaPathType have file names between quotes (apache/maven#2505). This is desired for producing robust target/javac.args files allowing users to reproduce a compilation. However, the compiler plugin also has a WorkaroundForPatchModule class because (as of Java 24) JavaFileManager does not accept StandardLocation.PATCH_MODULE_PATH in calls to setLocationForModule(…). That workaround expect file names without quotes. Therefore, the quotes added by Maven core needs to be removed.

Note: it does not necessarily means that Maven core should be modified, because WorkaroundForPatchModule is really (as its name implies) a workaround for a problem that should not exist.

… filenames between quotes.

Opportunistically add a safety when path using only for debugging purposes cannot be relativized.
@desruisseaux desruisseaux requested a review from gnodet November 10, 2025 16:01
@desruisseaux desruisseaux added the bug Something isn't working label Nov 10, 2025
@desruisseaux desruisseaux added this to the 4.0.0-beta-4 milestone Nov 10, 2025
@desruisseaux desruisseaux changed the title Fix compatibility with Maven Core 4.0.0-rc-5 Fix compatibility with Maven Core 4.1.0-SNAPSHOT Nov 13, 2025
desruisseaux added a commit to Geomatys/maven that referenced this pull request Nov 13, 2025
This is a partial revert of apache#2505
based on the constatation that above PR has not been merged in 4.0.x.
For making the two branches consistent, we need to either port or revert 2505.
A revert is less disruptive as no Maven 4.1.x version has been released yet
and it would avoid apache/maven-compiler-plugin#991.
desruisseaux added a commit to Geomatys/maven that referenced this pull request Nov 13, 2025
This is a partial revert of apache#2505
based on the observation that above PR has not been merged in 4.0.x.
For making the two branches consistent, we need to either port or revert 2505.
A revert is less disruptive as no Maven 4.1.x version has been released yet
and it would avoid apache/maven-compiler-plugin#991.
@gnodet
Copy link
Contributor

gnodet commented Nov 13, 2025

Edit: a previous version of this pull request wrongly said that this issue exists since Maven core 4.0.0-rc-5. However after verification, it seems that apache/maven#2505 has never been ported to the 4.0.x branch.

Since Maven core 4.1.0-SNAPSHOT, options formatted by JavaPathType have file names between quotes (apache/maven#2505). This is desired for producing robust target/javac.args files allowing users to reproduce a compilation. However, the compiler plugin also has a WorkaroundForPatchModule class because (as of Java 24) JavaFileManager does not accept StandardLocation.PATCH_MODULE_PATH in calls to setLocationForModule(…). That workaround expect file names without quotes. Therefore, the quotes added by Maven core needs to be removed.

Note: it does not necessarily means that Maven core should be modified, because WorkaroundForPatchModule is really (as its name implies) a workaround for a problem that should not exist.

Would it be better to backport #2505 ?
Or should the java compiler add the quotes maybe ?
Or maybe support both quoted and unquoted paths ? (and add /remove the quotes as needed) ?

Related to #11435

@desruisseaux
Copy link
Contributor Author

I propose to not backport 2505. The reason is that quotes are wanted when generating a shell script, but not wanted when using javax.tools or ToolProvider API (their addition was the cause of JUnit test failures). We could add a quote argument to the JavaPathType.option(Iterable) method in Maven core, but I'm not sure if it is worth.

desruisseaux added a commit to apache/maven that referenced this pull request Nov 13, 2025
This is a partial revert of #2505
based on the observation that above PR has not been merged in 4.0.x.
For making the two branches consistent, we need to either port or revert 2505.
A revert is less disruptive as no Maven 4.1.x version has been released yet
and it would avoid apache/maven-compiler-plugin#991.
@desruisseaux
Copy link
Contributor Author

Discard the pull request. This is replaced by apache/maven#11435.

@github-actions github-actions bot removed this from the 4.0.0-beta-4 milestone Nov 13, 2025
@desruisseaux desruisseaux deleted the fix/filenames-between-quotes branch November 13, 2025 14:22
@desruisseaux desruisseaux self-assigned this Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants