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.

          <JAVA_1_4_HOME>C:\Program Files\Java\j2sdk1.4.2_09</JAVA_1_4_HOME>

If you build with a different JDK, you may want to customize the jar file manifest.