Reputation: 21
Maven-compiler-plugin configuration
...
<fork>true</fork>
<executable>${env.JAVA_HOME}\bin\javac.exe</executable>
...
Upvotes: 1
Views: 3323
Reputation: 16820
Maven compiler plugin has a good official documentation page explaining all plugin options.
<fork>
: Allows running the compiler in a separate process. If false it uses the built in compiler, while if true it will use an executable.
<executable>
: Sets the executable of the compiler to use when fork is true
Upvotes: 2
Reputation: 1246
to add to Saikat’s answer:
If <executable>
is omitted and <fork>true</fork>
is set, the maven-compiler-plugin will chose the JAVA_HOME/bin/javac
binary.
If <fork>false</fork>
is set, the maven-compiler-plugin will chose the compiler via the ToolProvider interface. This means that no new process will be started, and the same Java VM your Maven is running it will also do the compilation.
With <fork>false</fork>
, you can also chose another compiler using the compilerId
parameter.
Tip: Go with the defaults unless you have a good reason to change them. The only good reason I could thing of right now is a bug in JDK 16.
Using another javac from another java installation is NOT a good reason: You should use toolchains for this.
Upvotes: 1