Mikkel Kjeldsen opened MCOMPILER-572 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 codehaus-plexus/plexus-compiler#351, filed in response to google/error-prone#4256.
The sample POM
<?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>
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 Compiler argument with newline treated as multiple arguments in fork mode
Remote Links:
Mikkel Kjeldsen opened MCOMPILER-572 and commented
Versions of
maven-compiler-pluginthat rely onplexus-compiler-2.14.2, hereundermaven-compiler-plugin-3.12.1, cannot pass multi-line compiler arguments to a forkedjavacon 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 codehaus-plexus/plexus-compiler#351, filed in response to google/error-prone#4256.
The sample POM
should fail to compile with the error
but instead fails with the error
because
plexus-compilerindiscriminately translates the \ to / and breaksjavac's multi-line argument support.Affects: 3.12.1
Issue Links:
Remote Links: