#!/bin/bash
# Extract the current version from the parent pom.xml
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
# Split the version into an array
IFS='.' read -r -a version_parts <<< "$current_version"
# Increment the patch version (assuming version format is major.minor.patch)
new_patch_version=$((version_parts[2] + 1))
# Construct the new version
new_version="${version_parts[0]}.${version_parts[1]}.$new_patch_version"
# Update the version in the parent pom.xml and all modules
mvn versions:set -DnewVersion=$new_version -DgenerateBackupPoms=false
echo "Updated version from $current_version to $new_version"
- Make the Script Executable:
- Ensure the script is executable by running the following command:
No comments:
Post a Comment