Example of how to produce a MRJAR with Gradle
Switch branches/tags
Nothing to show
Clone or download
melix Add link to the blog post
Replace the initial documentation with a link to the blog post explaining the consequences of using mrjars.
Latest commit e342aa6 Dec 22, 2017


Building a MRJAR with Gradle

WARNING: Before doing this, we strongly recommend to read this blog post which highlights the consequences of your decision.


By default, this build expects you to run on JDK 9. If you do, it will configure the various Java compilation tasks to use --release with the same level as their source compatibility level. In other words, the Java 8 source set will use --release 8, while the Java 9 source set will use --release 9. This will let each source set compile against the appropriate Java API.

If you don't run on JDK 9, then you will need to setup path to the various JDKs, using environment variables:

  • JAVA_8 must point to a valid JDK 8 installation
  • JAVA_9 must point to a valid JDK 9 installation

Then you need to run with -PcrossCompile, which will enable cross-compilation: compilation will be forked and each Java compile task will use the appropriate JDK.