You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
UrlsController/installAndRun.sh

35 lines
1.1 KiB
Bash

cd "${0%/*}" || (echo "Could not chdir to this script's dir!" && exit) # Change the working directory to the script's directory, when running from other location.
justInstall=0
if [[ $# -eq 1 ]]; then
justInstall=$1
elif [[ $# -gt 1 ]]; then
echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: script.sh <justInstall: 0 | 1>"; exit 1
fi
gradleVersion="7.2"
if [[ justInstall -eq 0 ]]; then
wget https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip
sudo mkdir /opt/gradle
sudo unzip -d /opt/gradle gradle-${gradleVersion}-bin.zip
#ls /opt/gradle/gradle-${gradleVersion} # For debugging installation
export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin
gradle wrapper --gradle-version=${gradleVersion} --distribution-type=bin
#gradle tasks # For debugging installation
#gradle -v # For debugging installation
gradle clean
gradle build
else
export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin # Make sure the gradle is still accessible (it usually isn't without the "export").
fi
gradle bootRun