I am using maven 3.3.3. and I have <fork>true</fork>
. I ran into issues(MojoException) and fixed it by commenting out
<fork>true</fork>
<compilerVersion>${java.version}</compilerVersion>
My project was using Java 1.6 and java.version in above line refers to 1.6, but my computer environment variables was 1.7 and maven 3.3.3 needs Java 1.7 . Now my issues are fixed.
But I am not able to understand 1) what does fork mean here? 2) What does it do? 3) Having it set to true or false, what changes it?
I went through the documentation, but it is hard to follow. Thanks.
true
means it will create (fork) a new JVM to run the compiler. This is a bit slower but the isolation is better.
Especially you can specify a different JVM than the one Maven is started with, and you can also specify command line parameters (for increasing Heapsize or Metaspace) only in this case. In your case it causes problems as it seem to use the wrong JVM, you could specify the full path with <executable>
or a toolchain configuration.
This is one method to use a modern Maven which does not run with Java 1.6, but still use a clean compile environment for older source/target versions.
false
means it is startign the compiler directly in the JVM you have run maven with, this makes the build less repeatable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With