Maven jvm.config instead of fork/compilerArgs
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
The error prone maven instructions for jdk16+[^1] recommend using `compilerArgs` and `fork`. I was able to supply those same args to maven itself via `.mvn/jvm.config` file[^2] and get a 4x improvement of build times by no longer forking the compiler.
Anecdotally, with my sample size of 1, using a maven reactor with 80 modules the build time for `mvn clean compile` was 11s using `.mvn/jvm.config` and 44s when forking the compiler.
The maven-compiler-plugin docs[^3] leads me to believe that `fork` was designed for use cases where a different JDK was wanting to be used, rather than for configuration isolation while using the default javac. Thats not to say it can't also work when config isolation is desired, like in this case.
Does errorprone need that level of isolation on the exports/opens configuration? Would the maintainers be open to updating the docs to include the `.mvn/jvm.config` option with the pros/con between the two approaches? or if the config isolation is not needed and the performance impact is impactful enough, change the recommendation to the non-forking option.
[^1]: https://errorprone.info/docs/installation#jdk-16
[^2]: https://maven.apache.org/configure.html#mvn-jvm-config-file
[^3]: https://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
Contributor guide
Assessment
This issue has not been assessed yet.