From 6cd05f98f145e3d19a673b4053770cd2441c0d34 Mon Sep 17 00:00:00 2001 From: Kevin Sandi Date: Wed, 31 Dec 2025 17:06:30 -0600 Subject: [PATCH] Fix: Pin clm-maven-plugin based on Java version Issue-ID: IT-29115 Signed-off-by: Kevin Sandi Change-Id: I2de68564fcf3f3d289b3faae271f11c76a678827 --- .../notes/pin-clm-maven-plugin-2ecb4c26c457f72b.yaml | 6 ++++++ shell/sonatype-clm.sh | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/pin-clm-maven-plugin-2ecb4c26c457f72b.yaml diff --git a/releasenotes/notes/pin-clm-maven-plugin-2ecb4c26c457f72b.yaml b/releasenotes/notes/pin-clm-maven-plugin-2ecb4c26c457f72b.yaml new file mode 100644 index 00000000..04bdf644 --- /dev/null +++ b/releasenotes/notes/pin-clm-maven-plugin-2ecb4c26c457f72b.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Pin CLM Maven Plugin to version 2.54.1-02 to address compatibility + issues when using Java versions lower than 17. Use latest plugin + version when using Java 17 or higher. diff --git a/shell/sonatype-clm.sh b/shell/sonatype-clm.sh index 5921c5e9..8b0f02ad 100644 --- a/shell/sonatype-clm.sh +++ b/shell/sonatype-clm.sh @@ -19,9 +19,19 @@ set +u export MAVEN_OPTS +# Determine CLM plugin version based on Java version +JAVA_VERSION=$(java -version 2>&1 | grep -i version | head -n 1 \ + | sed 's/.*version "\(.*\)".*/\1/' | cut -d'.' -f1 | sed 's/^1\.//') + +CLM_PLUGIN_VERSION='' # Leave empty to use latest version by default + +if [[ "$JAVA_VERSION" -lt 17 ]]; then + CLM_PLUGIN_VERSION="2.54.1-02" +fi + # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters. # shellcheck disable=SC2086 -$MVN $MAVEN_GOALS dependency:tree com.sonatype.clm:clm-maven-plugin:index \ +$MVN $MAVEN_GOALS dependency:tree com.sonatype.clm:clm-maven-plugin:${CLM_PLUGIN_VERSION}:index \ --global-settings "$GLOBAL_SETTINGS_FILE" \ --settings "$SETTINGS_FILE" \ -DaltDeploymentRepository=staging::file:"$WORKSPACE"/m2repo \ -- 2.16.6