diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-07-23 00:28:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-23 00:28:55 +0300 |
commit | c527a7a0afab18d29f2d828b3cc6c796ac50ac50 (patch) | |
tree | b006df3a44e83ce142dc8027a0ace78d49d6e2cb /src/java/install.sh | |
parent | 9b610330555d72309d1b4316bac2f9486b1cdb25 (diff) |
Java: bundle maven and gradle as options (#68)
bundle maven and gradle
Diffstat (limited to 'src/java/install.sh')
-rw-r--r-- | src/java/install.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/java/install.sh b/src/java/install.sh index 64646fa..411fffb 100644 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -10,6 +10,8 @@ # Syntax: ./java-debian.sh [JDK version] [SDKMAN_DIR] [non-root user] [Add to rc files flag] JAVA_VERSION=${VERSION:-"lts"} +INSTALL_GRADLE=${INSTALL_GRADLE:-"false"} +INSTALL_MAVEN=${INSTALL_MAVEN:-"false"} export SDKMAN_DIR=${SDKMAN_DIR:-"/usr/local/sdkman"} USERNAME=${USERNAME:-"automatic"} @@ -167,4 +169,16 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk default java ${JAVA_VERSION}" fi +# Install Gradle +if [[ "${INSTALL_GRADLE}" = "true" ]] && ! gradle --version > /dev/null; then + sdk_install gradle latest + updaterc '[ -z "${GRADLE_USER_HOME}" ] && export GRADLE_USER_HOME=${HOME}/.gradle' +fi + +# Install Maven +if [[ "${INSTALL_MAVEN}" = "true" ]] && ! mvn --version > /dev/null; then + sdk_install maven latest + updaterc '[ -z "$M2" ] && export M2=$HOME/.m2' +fi + echo "Done!" |