From 33e15c0a63ef6ee785663529990909a3e981fe69 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 28 Jun 2020 13:49:57 +0530 Subject: [PATCH] JAVA-49: Moved versions-maven-plugin to maven-modules --- maven-modules/versions-maven-plugin/README.md | 7 ++ .../versions-maven-plugin/original/pom.xml | 82 +++++++++++++++++++ maven-modules/versions-maven-plugin/pom.xml | 81 ++++++++++++++++++ .../versions-maven-plugin/run-the-demo.sh | 74 +++++++++++++++++ 4 files changed, 244 insertions(+) create mode 100644 maven-modules/versions-maven-plugin/README.md create mode 100644 maven-modules/versions-maven-plugin/original/pom.xml create mode 100644 maven-modules/versions-maven-plugin/pom.xml create mode 100644 maven-modules/versions-maven-plugin/run-the-demo.sh diff --git a/maven-modules/versions-maven-plugin/README.md b/maven-modules/versions-maven-plugin/README.md new file mode 100644 index 0000000000..19414a2a4b --- /dev/null +++ b/maven-modules/versions-maven-plugin/README.md @@ -0,0 +1,7 @@ +## Versions Maven Plugin + +This module contains articles about the Versions Maven Plugin. + +### Relevant Articles + +- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version) diff --git a/maven-modules/versions-maven-plugin/original/pom.xml b/maven-modules/versions-maven-plugin/original/pom.xml new file mode 100644 index 0000000000..f81596661e --- /dev/null +++ b/maven-modules/versions-maven-plugin/original/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + com.baeldung + original + 0.0.1-SNAPSHOT + + + + + commons-io + commons-io + ${commons-io.version} + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.apache.commons + commons-compress + ${commons-compress-version} + + + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} + + + + + + + + org.codehaus.mojo + versions-maven-plugin + ${versions.plugin.version} + + + org.apache.commons:commons-collections4 + + + + + + + + + apache.snapshots + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots/ + + false + + + true + + + + + + 1.15 + 2.3 + 4.0 + 3.0 + 1.9.1 + 2.7 + + + \ No newline at end of file diff --git a/maven-modules/versions-maven-plugin/pom.xml b/maven-modules/versions-maven-plugin/pom.xml new file mode 100644 index 0000000000..9793f55b28 --- /dev/null +++ b/maven-modules/versions-maven-plugin/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + com.baeldung + versions-maven-plugin + 0.0.1-SNAPSHOT + versions-maven-plugin + + + + commons-io + commons-io + ${commons.io.version} + + + + org.apache.commons + commons-collections4 + ${commons.collections4.version} + + + + org.apache.commons + commons-lang3 + ${commons.lang3.version} + + + + org.apache.commons + commons-compress + ${commons-compress-version} + + + + commons-beanutils + commons-beanutils + ${commons.beanutils.version} + + + + + + + org.codehaus.mojo + versions-maven-plugin + ${versions.plugin.version} + + + org.apache.commons:commons-collections4 + + + + + + + + + apache.snapshots + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots/ + + false + + + true + + + + + + 1.15 + 2.3 + 2.7 + 1.9.1 + 3.0 + 4.0 + + + \ No newline at end of file diff --git a/maven-modules/versions-maven-plugin/run-the-demo.sh b/maven-modules/versions-maven-plugin/run-the-demo.sh new file mode 100644 index 0000000000..89ca871e01 --- /dev/null +++ b/maven-modules/versions-maven-plugin/run-the-demo.sh @@ -0,0 +1,74 @@ +#!/bin/bash +#function to display commands +exe() { echo -e "\$ $@\n" ; "$@" ; } + +TEXT_COLOR='\033[1;33m' #Yellow +NO_COLOR='\033[0m' # No Color + +clear + +echo -e "======================================================================================" +echo -e " Showcase for the BAELDUNG tutorial \"Use the latest version of a dependency in Maven\"" +echo -e " Author: Andrea Ligios" +echo -e "======================================================================================" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Resetting the demo environment (which will be altered during the run): " +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +rm -f pom.xml.versionsBackup +cp original/pom.xml pom.xml +ls -lt pom.* +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Checking for newer versions of the Maven dependencies:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:display-dependency-updates +echo +read -p "Press enter to continue" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Updating SNAPSHOT dependencies to their RELEASE version, if any:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:use-releases +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " A backup has been created automatically:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +ls -lt pom.* +echo +read -p "Press enter to continue" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Updating RELEASE dependencies to their *next* RELEASE version:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:use-next-releases +echo +read -p "Press enter to continue" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Reverting every modification made since the beginning:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:revert +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " The backup is gone, and the pom.xml contains the initial dependencies:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +ls -lt pom.* +echo +read -p "Press enter to continue" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Updating RELEASE dependencies to their *latest* RELEASE version:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:use-latest-releases +echo +read -p "Press enter to continue" + +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " Committing the modifications to pom.xml:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +exe mvn versions:commit +echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------" +echo -e " The backup is gone, and the pom.xml contains the latest dependencies:" +echo -e "--------------------------------------------------------------------------------------${NO_COLOR}" +ls -lt pom.* +echo + +echo -e "${TEXT_COLOR}\nThat's all folks!${NO_COLOR}\n"