apache / apache/maven-compiler-plugin
[MCOMPILER-572] Multi-line <arg> does not work on Windows when forked
- Dominant language
- Java
- Stars
- 261
- Forks
- 191
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 8
Description
**[Mikkel Kjeldsen](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER303566)** opened **[MCOMPILER-572](https://issues.apache.org/jira/browse/MCOMPILER-572?redirect=false)** and commented
Versions of `maven-compiler-plugin` that rely on `plexus-compiler-2.14.2`, hereunder `maven-compiler-plugin-3.12.1`, cannot pass multi-line compiler arguments to a forked `javac` on Windows in any way. Further, attempting to do so produces a non-obvious and difficult to troubleshoot error. This error does not manifest outside of Windows, nor does it manifest on Windows if the compiler is not forked.
This bug is a downstream version of https://github.com/codehaus-plexus/plexus-compiler/issues/351, filed in response to https://github.com/google/error-prone/issues/4256.
The sample POM
```xml
4.0.0
example.multi-line-fork-crash
minimally-reproducible
1.0-SNAPSHOT
21
3.12.1
org.apache.maven.plugins
maven-compiler-plugin
${maven-compiler-plugin.version}
true
-Xplugin:ErrorProne \
-Xep:DeadException:WARN
```
_should_ fail to compile with the error
```
plug-in not found: ErrorProne
```
but instead fails with the error
```
error: invalid flag: -Xep:DeadException
```
because `plexus-compiler` indiscriminately translates the \ to / and breaks `javac` 's multi-line argument support.
---
**Affects:** 3.12.1
**Issue Links:**
- [MCOMPILER-425](https://issues.apache.org/jira/browse/MCOMPILER-425) Compiler argument with newline treated as multiple arguments in fork mode
**Remote Links:**
- [Maven multi-line \ does not work on Windows when \ed
](https://github.com/google/error-prone/issues/4256)
- [Forking JavacCompiler breaks multiline arguments on Windows
](https://github.com/codehaus-plexus/plexus-compiler/issues/351)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.