JDKs Maven Plugin

Downloads JDK distributions.

Install

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

Configuration DSL

JDKs must be defined either using the Foojay Disco API or explicitly.

Foojay Disco API

Pkgs must define the following properties

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

  • version: the version of the JDK.

  • platform: the platform this JDK is related to.

  • distribution: the distribution that provides the JDK. Defaults to zulu.

  • archiveType: the extension file. Defaults to zip.

  • javafxBundled: whether JavaFx should be bundled or not. Defaults to false.

Please be as specific as you can with the value of version to reduce the number of matches packages and increase reproducibility, for example 11.0.13 is better than just 11. The value for distribution are those defined by the Disco API, check the documentation for the full list. The value for archiveType should be either zip or tar.gz.

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, aarch64, mips_32, mipsel_32, mips_64, mipsel_64, ppc_32, ppcle_32, ppc_64, ppcle_64, s390_32, s390_64, riscv

Examples:

  • osx

  • osx-aarch64

  • 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.9.1-SNAPSHOT</version>
    <configuration>
        <pkgs>
            <pkg>
                <name>zulu11Linux</name>
                <platform>linux-x86_64</platform>
                <version>11.0.11</version>
            </pkg>
            <pkg>
                <name>zulu11Osx</name>
                <platform>osx-x86_64</platform>
                <version>11.0.11</version>
            </pkg>
            <pkg>
                <name>zulu11Windows</name>
                <platform>windows-x86_64</platform>
                <version>11.0.11</version>
            </pkg>
        </pkgs>
    </configuration>
</plugin>

Explicit

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, aarch64, mips_32, mipsel_32, mips_64, mipsel_64, ppc_32, ppcle_32, ppc_64, ppcle_64, s390_32, s390_64, riscv

Examples:

  • osx

  • osx-aarch64

  • 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.9.1-SNAPSHOT</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>
        </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:

jdks:list-disco

Lists all configured JDKs using the Foojay Disco API.

jdks:setup-disco

Downloads, verifies, and unpacks JDKs using the Foojay Disco API.

Available parameters:

  • connectTimeout (Default: 60)+ Connect timeout (in seconds).
    Type: int
    User property: "disco.setup.connect.timeout

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

  • readTimeout (Default: 20)
    Read timeout (in seconds).
    Type: int
    User property: disco.setup.read.timeout

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

jdks:list-jdks

Lists all configured JDKs.

jdks: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

jdks:list-disco
[INFO] --- jdks-maven-plugin:0.9.1-SNAPSHOT:list-disco (default-cli) @ app ---
[INFO] == Pkg zulu11Linux ==
[INFO] version:       11.0.11
[INFO] archiveType:   zip
[INFO] platform:      linux-x86_64
[INFO] distribution:  zulu
[INFO] javafxBundled: false
[INFO] package(s):    1
[INFO] filename:      zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] == Pkg zulu11Osx ==
[INFO] version:       11.0.11
[INFO] archiveType:   zip
[INFO] platform:      osx-x86_64
[INFO] distribution:  zulu
[INFO] javafxBundled: false
[INFO] package(s):    1
[INFO] filename:      zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] == Pkg zulu11Windows ==
[INFO] version:       11.0.11
[INFO] archiveType:   zip
[INFO] platform:      windows-x86_64
[INFO] distribution:  zulu
[INFO] javafxBundled: false
[INFO] package(s):    1
[INFO] filename:      zulu11.48.21-ca-jdk11.0.11-win_x64.zip
jdks:setup-disco
[INFO] --- jdks-maven-plugin:0.9.1-SNAPSHOT:setup-disco (default-cli) @ app ---
[INFO] Fetching [name='zulu11Linux', version='11.0.11', archiveType='zip', distribution='zulu', platform='linux-x86_64', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-linux_x64.zip
[INFO] Fetching [name='zulu11Osx', version='11.0.11', archiveType='zip', distribution='zulu', platform='osx-x86_64', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip
[INFO] Fetching [name='zulu11Windows', version='11.0.11', archiveType='zip', distribution='zulu', platform='windows-x86_64', javafxBundled='false']
[INFO] Downloading https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip
[INFO] Extracting zulu11.48.21-ca-jdk11.0.11-win_x64.zip
jdks:list-jdks
[INFO] --- jdks-maven-plugin:0.9.1-SNAPSHOT: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
jdks:setup-jdks
[INFO] --- jdks-maven-plugin:0.9.1-SNAPSHOT: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