Skip to content

Maven jvm.config instead of fork/compilerArgs #2786

@mattnelson

Description

@mattnelson

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 file2 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 docs3 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.

Footnotes

  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions