UrlsWorker/installAndRun.sh

38 lines
1.4 KiB
Bash
Executable File

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.
cd libs || exit
git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten.
# Do not need to perform a string-replace in "build.gradle", since it automatically gets all ".jar" files.
# Keep a backup of the existing JAR file.
mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar
cd PublicationsRetriever && mvn clean install
# Copy the created JAR file to the top libs directory.
cp target/publications_retriever-1.0-SNAPSHOT.jar ../publications_retriever-1.0-SNAPSHOT.jar
# Delete the directory with the source-code.
cd ../ && rm -rf PublicationsRetriever
# Clean and (re)build and run the project.
cd ../
echo -e "\nAsking for sudo, in order to verify the installation of 'gradle'..\n"
gradleVersion="7.2"
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}
export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin
gradle wrapper --gradle-version=${gradleVersion} --distribution-type=bin
gradle tasks
gradle -v
gradle clean
gradle build
gradle bootRun