[
https://issues.apache.org/jira/browse/MCOMPILER-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17810849#comment-17810849
]
Michael Osipov commented on MCOMPILER-572:
------------------------------------------
You are misusing this parameter:
https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#compilerArgs
This is *not* an arg line.
> Multi-line <arg> does not work on Windows when forked
> -----------------------------------------------------
>
> Key: MCOMPILER-572
> URL: https://issues.apache.org/jira/browse/MCOMPILER-572
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.12.1
> Reporter: Mikkel Kjeldsen
> Priority: Major
>
> 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
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>example.multi-line-fork-crash</groupId>
> <artifactId>minimally-reproducible</artifactId>
> <version>1.0-SNAPSHOT</version>
> <properties>
> <maven.compiler.release>21</maven.compiler.release>
> <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
> </properties>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>${maven-compiler-plugin.version}</version>
> <configuration>
> <fork>true</fork>
> <compilerArgs>
> <arg>
> -Xplugin:ErrorProne \
> -Xep:DeadException:WARN</arg>
> </compilerArgs>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>
> {code}
> _should_ fail to compile with the error
> {noformat}
> plug-in not found: ErrorProne
> {noformat}
> but instead fails with the error
> {noformat}
> error: invalid flag: -Xep:DeadException
> {noformat}
> because {{plexus-compiler}} indiscriminately translates the \ to / and breaks
> {{javac}} 's multi-line argument support.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)