From ee37dd260e1937b3b03c9104cdf09d0793aa9c0e Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 19 Apr 2024 08:08:20 +0900 Subject: [PATCH] GH-41280: [Release][Java] Make Maven version detection more robust (#41281) ### Rationale for this change If `mvn -v` uses escape sequence, our verification script detects wrong version information. ### What changes are included in this PR? Ensure disabling escape sequence of `mvn -v`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41280 Authored-by: Sutou Kouhei Signed-off-by: Jacob Wujciak-Jens --- dev/release/verify-release-candidate.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index f18b18aaa997c..77ea01e3eec04 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -502,7 +502,8 @@ maybe_setup_conda() { install_maven() { MAVEN_VERSION=3.8.7 if command -v mvn > /dev/null; then - SYSTEM_MAVEN_VERSION=$(mvn -v | head -n 1 | awk '{print $3}') + # --batch-mode is for disabling output color. + SYSTEM_MAVEN_VERSION=$(mvn --batch-mode -v | head -n 1 | awk '{print $3}') show_info "Found Maven version ${SYSTEM_MAVEN_VERSION} at $(command -v mvn)." else SYSTEM_MAVEN_VERSION=0.0.0 @@ -523,7 +524,8 @@ install_maven() { ${APACHE_MIRROR}/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz tar xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz export PATH=$(pwd)/apache-maven-${MAVEN_VERSION}/bin:$PATH - show_info "Installed Maven version $(mvn -v | head -n 1 | awk '{print $3}')" + # --batch-mode is for disabling output color. + show_info "Installed Maven version $(mvn --batch-mode -v | head -n 1 | awk '{print $3}')" else show_info "System Maven version ${SYSTEM_MAVEN_VERSION} is newer than minimum version ${MAVEN_VERSION}. Skipping installation." fi