Skip to content

Commit

Permalink
GH-41280: [Release][Java] Make Maven version detection more robust (#…
Browse files Browse the repository at this point in the history
…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 <kou@clear-code.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
  • Loading branch information
kou authored and raulcd committed Apr 29, 2024
1 parent a05dc9c commit ee37dd2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ee37dd2

Please sign in to comment.