Skip to content

Commit d4c7259

Browse files
keanjapesanGerrit Code Review
authored andcommitted
Merge "Fix: Pin clm-maven-plugin based on Java version"
2 parents 67cf436 + 6cd05f9 commit d4c7259

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Pin CLM Maven Plugin to version 2.54.1-02 to address compatibility
5+
issues when using Java versions lower than 17. Use latest plugin
6+
version when using Java 17 or higher.

shell/sonatype-clm.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ set +u
1919

2020
export MAVEN_OPTS
2121

22+
# Determine CLM plugin version based on Java version
23+
JAVA_VERSION=$(java -version 2>&1 | grep -i version | head -n 1 \
24+
| sed 's/.*version "\(.*\)".*/\1/' | cut -d'.' -f1 | sed 's/^1\.//')
25+
26+
CLM_PLUGIN_VERSION='' # Leave empty to use latest version by default
27+
28+
if [[ "$JAVA_VERSION" -lt 17 ]]; then
29+
CLM_PLUGIN_VERSION="2.54.1-02"
30+
fi
31+
2232
# Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
2333
# shellcheck disable=SC2086
24-
$MVN $MAVEN_GOALS dependency:tree com.sonatype.clm:clm-maven-plugin:index \
34+
$MVN $MAVEN_GOALS dependency:tree com.sonatype.clm:clm-maven-plugin:${CLM_PLUGIN_VERSION}:index \
2535
--global-settings "$GLOBAL_SETTINGS_FILE" \
2636
--settings "$SETTINGS_FILE" \
2737
-DaltDeploymentRepository=staging::file:"$WORKSPACE"/m2repo \

0 commit comments

Comments
 (0)