maven-compiler-plugin icon indicating copy to clipboard operation
maven-compiler-plugin copied to clipboard

[MCOMPILER-400] Explicit way to disable toolchain for compiler and use in-process compiler

Open jira-importer opened this issue 6 years ago • 1 comments

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:

  1. 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?

  2. 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.

  3. Document the current state of things as the supported way to achieve compilation-in-process-even-if-toolchain-is-configured.

 


Affects: 3.8.1

jira-importer avatar Sep 25 '19 09:09 jira-importer

Karl Heinz Marbaise commented

Why not compiling/running on JDK11 and defining release to 8 ?

jira-importer avatar Mar 07 '20 13:03 jira-importer