adopt-openjdk-downloader

Java library to ease downloading and installation of AdoptOpenJdk java JDK's and JRE's

License

License

Categories

Categories

Ant Build Tools
GroupId

GroupId

io.github.terjouxanthony
ArtifactId

ArtifactId

adopt.openjdk.downloader
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

adopt-openjdk-downloader
Java library to ease downloading and installation of AdoptOpenJdk java JDK's and JRE's
Project URL

Project URL

https://github.com/terjouxanthony/adopt-openjdk-downloader
Source Code Management

Source Code Management

https://github.com/terjouxanthony/adopt-openjdk-downloader/tree/main/

Download adopt.openjdk.downloader

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.terjouxanthony/adopt.openjdk.downloader/ -->
<dependency>
    <groupId>io.github.terjouxanthony</groupId>
    <artifactId>adopt.openjdk.downloader</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.terjouxanthony/adopt.openjdk.downloader/
implementation 'io.github.terjouxanthony:adopt.openjdk.downloader:0.0.1'
// https://jarcasting.com/artifacts/io.github.terjouxanthony/adopt.openjdk.downloader/
implementation ("io.github.terjouxanthony:adopt.openjdk.downloader:0.0.1")
'io.github.terjouxanthony:adopt.openjdk.downloader:jar:0.0.1'
<dependency org="io.github.terjouxanthony" name="adopt.openjdk.downloader" rev="0.0.1">
  <artifact name="adopt.openjdk.downloader" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.terjouxanthony', module='adopt.openjdk.downloader', version='0.0.1')
)
libraryDependencies += "io.github.terjouxanthony" % "adopt.openjdk.downloader" % "0.0.1"
[io.github.terjouxanthony/adopt.openjdk.downloader "0.0.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.30
com.fasterxml.jackson.core : jackson-databind jar 2.12.3
commons-codec : commons-codec jar 1.15
org.apache.commons : commons-compress jar 1.20
net.lingala.zip4j : zip4j jar 2.6.1
com.squareup.okhttp3 : okhttp jar 4.9.1

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.20

test (4)

Group / Artifact Type Version
commons-io : commons-io jar 2.8.0
org.junit.jupiter : junit-jupiter jar
org.mockito : mockito-junit-jupiter jar 2.23.0
org.assertj : assertj-core jar 3.17.2

Project Modules

There are no modules declared in this project.

AdoptOpenJDK downloader

Java library to ease downloading and installation of AdoptOpenJdk java JDK's and JRE's.

It can be useful in a gradle build or a maven plugin, in order to automate the packaging of a java application for multiple platforms.

Dependency:
<dependency>
  <groupId>io.github.terjouxanthony</groupId>
  <artifactId>adopt.openjdk.downloader</artifactId>
  <version>0.0.1</version>
</dependency>
Usage:
    public static void main(String[] args) throws HttpStatusException, IOException, URISyntaxException, InterruptedException {

        final JavaDownloader javaDownloader = new JavaDownloader();

        // Downloads and installs a GA hotspot JDK/JRE from AdoptOpenJDK vendor.
        // If the JDK/JRE is already present, no download is performed, except if the flag 'downloadLatest' is true and if there are minor/bug fixes for the java version supplied.
        final JavaInstallDescription installation = javaDownloader.installJava(
                InstallJavaParams.builder()
                        .arch("x64") // "x64", "x32", "ppc64", "arm" ...
                        .os("windows") // "linux", "windows", "mac", "solaris" ...
                        .javaVersion(16) // 11, 12, 13 ...
                        //.fullJavaReleaseName("jdk-16.0.1+9") // you can choose an exact version, it takes precedence over the parameter 'javaVersion'
                        .downloadLatest(false) // set to true to always fetch the latest version with bugfixes
                        .cleanExistingSameMajorVersion(true) // delete the previously downloaded versions for java 16 here
                        .imageType(Model.ImageType.JRE) // can also be JDK
                        .javaDownloaderDir(Paths.get("G:\\projects\\java\\test")) // root folder to store JRE's and JDK's, defaults to $HOME/.m2/java
                        .build());

        System.out.println(installation.getInstallPath()); // Folder containing the downloaded JDK/JRE
        System.out.println(installation.getJdkHomePath()); // JAVA_HOME path for this JDK/JRE
    }
Build:
mvn clean compile test
Run example:
mvn -q clean compile exec:java
Related links:

https://adoptopenjdk.net/

Versions

Version
0.0.1