[MCOMPILER-400] Explicit way to disable toolchain for compiler and use in-process compiler
Tuure Laurinolli opened MCOMPILER-400 and commented
We use toolchains configured with the Maven Toolchains plugin to run tests on both JDK 8 and JDK 11. We still only compile on JDK 8, and the JVM runnin Maven is 8. We want to avoid forking a new JVM per-compilation because it more than doubles the basic build & run unit tests time for out project from 200 to 450 seconds since our module structure is fairly granular.
By looking at the source code of Maven Compiler plugin, we figured out that setting fork to false and executable to whatever we can avoid using a toolchain in the compiler plugin. However, this seems rather hackish, and we would like to see a solution that's morelikely to stay supported in the future as well.
Some options that come to mind:
-
Don't use toolchain if fork is disabled, regardless of executable value. The upside is that this is arguably what should happen anyway. Why would we want to fork in the presence of a toolchain if fork is set to false?
-
Add a specific flag to disable toolchain usage in the compiler plugin, regardless of other flags. Better than 1) in that current configurations retain their current semantics, but seems a bit odd.
-
Document the current state of things as the supported way to achieve compilation-in-process-even-if-toolchain-is-configured.
Affects: 3.8.1