JDKs Maven Plugin

Downloads JDK distributions.

Install

pom.xml
<plugin>
  <groupId>org.jreleaser</groupId>
  <artifactId>jdks-maven-plugin</artifactId>
  <version>0.4.0</version>
</plugin>

Configuration DSL

JDKS must define the following properties:

  • name: a user defined name, must be unique.

  • url: the URL from where the JDK can be downloaded.

  • checksum: the checksum value used to verify the archive’s integrity.

  • platform: the platform this JDK is related to.

The checksum property accepts thew following formats:

  • <algorithm>/<checksum>

  • <checksum>

The value of <algorithm> must match those specified at MessageDigest section in the Java Security Standard Algorithm Names Specification. If no value for <algorithm> is given then SHA-256 is assumed.

The value of platform is dictated by the normalized values detected by os-maven-plugin. You may use the plain platform value or append a arch classifier. The following values are currently recognized:

platform

aix, hpux, os400, linux, linux_musl, osx, freebsd, openbsd, netbsd, sunos, windows, zos.

arch

x86_64, x86_32, itanium_64, itanium_32, sparc_32, sparc_64, arm_32, aarch_64, mips_32, mipsel_32, mips_64, mipsel_64, ppc_32, ppcle_32, ppc_64, ppcle_64, s390_32, s390_64, riscv

Examples:

  • osx

  • osx-arm

  • windows

  • linux

  • linux-x86_64

Use linux_musl for artifacts that target Alpine Linux.

Here’s an example configuration

<plugin>
  <groupId>org.jreleaser</groupId>
  <artifactId>jdks-maven-plugin</artifactId>
  <version>0.4.0</version>
  <configuration>
      <jdks>
          <jdk>
              <name>zulu11Linux</name>
              <platform>linux</platform>
              <url>https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip</url>
              <checksum>9d1718ef74c29a8148b67ddd90bc9267fc1614e0a1eb0f4ea16e234e86419a60</checksum>
          </jdk>
          <jdk>
              <name>zulu11Windows</name>
              <platform>windows</platform>
              <url>https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip</url>
              <checksum>7bcbaedecca73811f70a5ee89e9258afff9bc009286449d97d9b3105f52a1a3a</checksum>
          </jdk>
          <jdk>
              <name>zulu11Osx</name>
              <platform>osx</platform>
              <url>https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip</url>
              <checksum>abc3a9696fb6c10efcf3c5878cdb049244b0ba5dcc7141c6f0f88b99df626d2a</checksum>
          </jdk>
          <jdk>
              <name>graal21.1.0-linux</name>
              <platform>linux</platform>
              <url>https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz</url>
              <checksum>39252954d2cb16dbc8ce4269f8b93a326a0efffdce04625615e827fe5b5e4ab7</checksum>
          </jdk>
      </jdks>
  </configuration>
</plugin>

Goals

None of the exposed MOJOs are bound to a specific life-cycle phase, letting you decide when and how that should happen in your build.

The following MOJOs are provided:

jreleaser:list-jdks

Lists all configured JDKS.

jreleaser:setup-jdks

Downloads, verifies, and unpacks JDKs.

Available parameters:

  • jdkName
    The name of the JDK to be downloaded.
    Type: String
    User property: jdk.name

  • outputDirectory (Default: ${project.build.directory}/jdks)
    Type: File
    User property: jdks.output.directory

  • skip
    Skip execution.
    Type: boolean
    User property: jdks.setup.skip

Examples

[INFO] --- jdks-maven-plugin:0.4.0:list-jdks (default-cli) @ app ---
[INFO] == JDK zulu11Linux ==
[INFO] url: https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] checksum: 9d1718ef74c29a8148b67ddd90bc9267fc1614e0a1eb0f4ea16e234e86419a60
[INFO] platform: linux
[INFO]
[INFO] == JDK zulu11Windows ==
[INFO] url: https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] checksum: 7bcbaedecca73811f70a5ee89e9258afff9bc009286449d97d9b3105f52a1a3a
[INFO] platform: windows
[INFO]
[INFO] == JDK zulu11Osx ==
[INFO] url: https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] checksum: abc3a9696fb6c10efcf3c5878cdb049244b0ba5dcc7141c6f0f88b99df626d2a
[INFO] platform: osx
[INFO]
[INFO] == JDK graal21.1.0-linux ==
[INFO] url: https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz
[INFO] checksum: 39252954d2cb16dbc8ce4269f8b93a326a0efffdce04625615e827fe5b5e4ab7
[INFO] platform: linux
[INFO] --- jdks-maven-plugin:0.4.0:setup-jdks (default-cli) @ app ---
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Verifying zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] Verifying zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Verifying zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Downloading https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz
[INFO] Verifying graalvm-ce-java11-linux-amd64-21.1.0.tar.gz
[INFO] Extracting graalvm-ce-java11-linux-amd64-21.1.0.tar.gz
[INFO] Expanding: /Users/aalmiray/tmp/app/target/jdks/graalvm-ce-java11-linux-amd64-21.1.0.tar.gz into /Users/duke/app/target/jdks