apache / apache/maven-compiler-plugin

[MCOMPILER-435] Plugin does not report actual error from ErrorProne when toolchain is used

Open
#658 4 comments 0 reactions 0 assignees View on GitHub
bug priority:critical
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[Rocher Suchard](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rocher.suchard)** opened **[MCOMPILER-435](https://issues.apache.org/jira/browse/MCOMPILER-435?redirect=false)** and commented

Hello,

I followed ErrorProne installation (http://errorprone.info/docs/installation and http://errorprone.info/docs/patching) but I did not provide a `-XepPatchCheck` which result in an error that `maven-compiler-plugin` fails to report when a toolchain is used:

Without a toolchain, I get this error which is what I expect, eg: something that helps!

```java
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on
project maven-compiler-plugin-error-prone: Fatal error compiling: -XepPatchChecks and -XepPatchLocation must be specif
ied together -> [Help 1]
```

With a JDK 11 toolchain, the error won't help, neither the (huge) stacktrace when using `-e`.

```java
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on
project maven-compiler-plugin-error-prone: Compilation failure -> [Help 1]
```

`maven-compiler-plugin` is unable to report correctly the `com.google.errorprone.InvalidCommandLineOptionException` thrown by ErrorProne when a toolchain is used (in this case, the toolchain is useless, but I have profile with Java 15).

The attached file contains a sample project:
- To test the case when it reports the ErrorProne exception, simply do `./mvnw clean install`
- To test the case with a JDK 11 toolchain, simply do `./mvnw -Puse-toolchain clean install`

Java 11 is both required to build, and as a toolchain.

---

**Affects:** 3.8.1

**Attachments:**
- [maven-compiler-plugin-3.13.0-error-prone.zip](https://issues.apache.org/jira/secure/attachment/13074805/maven-compiler-plugin-3.13.0-error-prone.zip) (_12.17 kB_)
- [maven-compiler-plugin-3.8.1-error-prone.zip](https://issues.apache.org/jira/secure/attachment/13013221/maven-compiler-plugin-3.8.1-error-prone.zip) (_12.94 kB_)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.