Nov 1, 2018

How to Compile Sources Using A Different JDK in Maven

Compiling Sources Using A Different JDK

The compilerVersion parameter can be used to specify the version of the compiler that the plugin will use. However, you also need to set fork to true for this to work. For example:
          <executable><!-- path-to-javac --></executable>
To avoid hard-coding a filesystem path for the executable, you can use a property. For example:
Each developer then defines this property in settings.xml, or sets an environment variable, so that the build remains portable.