Corretto JDK Wrapper
A wrapper script to manage downloading Corretto JDK or re-using a previously downloaded version.
See https://aws.amazon.com/corretto for Corretto JDK
releases.
Compatibility
Currently, this is only compatible with Linux and MacOS and Java 11+.
Use Case
The primary use case for this tooling is transient build agents, but it can also be used in conjunction with other tools to improve developer experience.
Installation
Create a .corretto/wrapper.properties
file in root of repository.
mkdir -p .corretto
touch .corretto/wrapper.properties
Add a valid Corretto JDK version
and dist
to the file.
version = 17.0.4.9.1
dist = linux-x64
Add the correttow
executable file to the root of the repository.
curl -ksLO https://raw.githubusercontent.com/brianwyka/corretto-jdk-wrapper/main/correttow & chmod +x correttow
Usage
Export the Corretto JDK Home location to JAVA_HOME
environment variable.
Uses version and dist from .corretto/wrapper.properties
export JAVA_HOME=$(./correttow)
Specify version and dist in the command (overrides file)
export JAVA_HOME=$(./correttow '17.0.4.9.1' 'linux-x64')
Integrations
This tooling is meant to integrate with other build tools such as jEnv
, Maven
, and Gradle
.
For example, with jenv
:
jenv add $(./correttow)
For example, with maven
:
export JAVA_HOME=$(./correttow)
mvn clean install
For example, with gradle
:
gradle -Dorg.gradle.java.home=$(./correttow) clean build