![]() |
| lingocoder |
![]() |
mrJar Modular MRJAR Files Made Easy Due to a breaking change in Gradle 5.6.1, current versions of mrJar are confirmed to work only with Gradle versions 5.0.0 to 5.5.1 Usage:
/* (1) Decide which type of module artifact your project needs to produce and proceed accordingly */
/* */
/* (a) A Single-Release Jar File that targets a single JDK release and packages a single module */
/* • DO NOT set any JDK release environment variables. Proceed to (2) */
/* */
/* (b) A Multi-Release Jar File that targets two or more Java 9+ releases. */
/* • Set two environment variables. One named JAVA_8 and the other named JAVA_9. */
/* They must refer to the file system installations of JDK version 8 and 9 respectively. */
/* */
/* (2) Apply the mrjar plugin using the plugins DSL. */
plugins{
id 'com.lingocoder.mrjar' version '0.0.5'
}
/* (3) Configure repositories. jcenter is preferred by Gradle.org. */
repositories {jcenter()}
dependencies {
/* Declare your api|implementation|testImplementation dependencies required by your system. */
api 'com.example:foo:0.0.0'
implementation 'net.bar:etc-etc:18.0'
...
}
mrjar {
/* (4) Tell mrjar which releases you want your MRJAR File to support */
/* • this property is mandatory. The values must be Gradle's version enum types */
releases = [JavaVersion.VERSION_12, JavaVersion_11]
/* (5) Optionally, you can tell mrjar to create the packages you need */
/* • each package in the list will be created in each release src directory */
packages = ['org.example.foo', 'io.another.one',...]
/* (6) Optionally, tell mrjar you want a modular MRJAR */
/* • or just the existence of a module-info.java file has the same effect */
isModular = true (or false)
/* (7) Optionally, tell mrjar to use a specific name for your module. */
/* • by default, mrJar uses the project name and version */
moduleName = 'foo.bar'
/* (8) Optionally — or, mandatorily if you're using Gradle's Application */
/* Plugin to execute a Java application bundled in your module — tell */
/* mrjar the binary name of the class you want the Application Plugin to run */
/* • the value of this property will automatically propagate to the */
/* Application Plugin's :run task */
main = 'com.acme.main.JavaMain'
}
From the command line, run: $ ./gradlew :mrinit
|
|||||||||||