|
| 1 | +#!/bin/bash |
| 2 | +#function to display commands |
| 3 | +exe() { echo -e "\$ $@\n" ; "$@" ; } |
| 4 | + |
| 5 | +TEXT_COLOR='\033[1;33m' #Yellow |
| 6 | +NO_COLOR='\033[0m' # No Color |
| 7 | + |
| 8 | +clear |
| 9 | + |
| 10 | +echo -e "======================================================================================" |
| 11 | +echo -e " Showcase for the BAELDUNG tutorial \"Use the latest version of a dependency in Maven\"" |
| 12 | +echo -e " Author: Andrea Ligios" |
| 13 | +echo -e "======================================================================================" |
| 14 | + |
| 15 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 16 | +echo -e " Resetting the demo environment (which will be altered during the run): " |
| 17 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 18 | +rm -f pom.xml.versionsBackup |
| 19 | +cp original/pom.xml pom.xml |
| 20 | +ls -lt pom.* |
| 21 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 22 | +echo -e " Checking for newer versions of the Maven dependencies:" |
| 23 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 24 | +exe mvn versions:display-dependency-updates |
| 25 | +echo |
| 26 | +read -p "Press enter to continue" |
| 27 | + |
| 28 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 29 | +echo -e " Updating SNAPSHOT dependencies to their RELEASE version, if any:" |
| 30 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 31 | +exe mvn versions:use-releases |
| 32 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 33 | +echo -e " A backup has been created automatically:" |
| 34 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 35 | +ls -lt pom.* |
| 36 | +echo |
| 37 | +read -p "Press enter to continue" |
| 38 | + |
| 39 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 40 | +echo -e " Updating RELEASE dependencies to their *next* RELEASE version:" |
| 41 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 42 | +exe mvn versions:use-next-releases |
| 43 | +echo |
| 44 | +read -p "Press enter to continue" |
| 45 | + |
| 46 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 47 | +echo -e " Reverting every modification made since the beginning:" |
| 48 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 49 | +exe mvn versions:revert |
| 50 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 51 | +echo -e " The backup is gone, and the pom.xml contains the initial dependencies:" |
| 52 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 53 | +ls -lt pom.* |
| 54 | +echo |
| 55 | +read -p "Press enter to continue" |
| 56 | + |
| 57 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 58 | +echo -e " Updating RELEASE dependencies to their *latest* RELEASE version:" |
| 59 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 60 | +exe mvn versions:use-latest-releases |
| 61 | +echo |
| 62 | +read -p "Press enter to continue" |
| 63 | + |
| 64 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 65 | +echo -e " Committing the modifications to pom.xml:" |
| 66 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 67 | +exe mvn versions:commit |
| 68 | +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" |
| 69 | +echo -e " The backup is gone, and the pom.xml contains the latest dependencies:" |
| 70 | +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" |
| 71 | +ls -lt pom.* |
| 72 | +echo |
| 73 | + |
| 74 | +echo -e "${TEXT_COLOR}\nThat's all folks!${NO_COLOR}\n" |
0 commit comments