[ 
https://issues.apache.org/jira/browse/MCOMPILER-572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17811131#comment-17811131
 ] 

Mikkel Kjeldsen commented on MCOMPILER-572:
-------------------------------------------

bq. The value you have provided deliberately contains a space?

It deliberately contains an escaped line break, which {{javac}} will reliably 
interpret as a single argument, because that's how the {{-Xplugin}} option must 
be used. In other words, a hypothetical

{code:xml}
<arg>-Xplugin:ErrorProne</arg>
<arg>-Xep:DeadException:WARN</arg>
{code}

is an incorrect invocation of {{javac}}.

bq. If so, why are you try to add a line separator to it?

Because, not obvious from the reproduction sample I supplied, the Error Prone 
plugin accepts _a lot_ of arguments and these are much, much easier to organize 
across multiple lines. One example of that I have handy is 
{{jackson-databind}}, which stretches its configuration over 70 lines, at 
https://github.com/FasterXML/jackson-databind/blob/2.17/pom.xml#L468-L541; 
although {{jackson-databind}} uses the in-process compiler which doesn't 
require escaping line breaks.

bq. There is no code in this plugin to manage that.

I am aware of this. All that code is in {{plexus-compiler}} (specifically its 
{{JavacCompiler}}), as I have stated. However, I am a consumer of 
{{maven-compiler-plugin}} wherein the error manifests, not of 
{{plexus-compiler}} wherein the error originates, so only filing a ticket with 
{{plexus-compiler}} is insufficient.

> 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
>             Fix For: waiting-for-feedback
>
>
> 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)

Reply via email to