You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Mikkel Kjeldsen (Jira)" <ji...@apache.org> on 2024/01/24 20:05:00 UTC

[jira] [Updated] (MCOMPILER-572) Multi-line does not work on Windows when forked

     [ https://issues.apache.org/jira/browse/MCOMPILER-572?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikkel Kjeldsen updated MCOMPILER-572:
--------------------------------------
    Description: 
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 (Forking JavacCompiler breaks multiline arguments on Windows), filed in response to https://github.com/google/error-prone/issues/4256 (Maven multi-line <arg> does not work on Windows when <fork>ed).

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.

  was:
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 (Forking JavacCompiler breaks multiline arguments on Windows).

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.


> 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 (Forking JavacCompiler breaks multiline arguments on Windows), filed in response to https://github.com/google/error-prone/issues/4256 (Maven multi-line <arg> does not work on Windows when <fork>ed).
> 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)