You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aa...@apache.org on 2020/03/27 02:44:31 UTC

[yetus] branch master updated: YETUS-957. maven.sh fails to parse maven version (#99)

This is an automated email from the ASF dual-hosted git repository.

aajisaka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new 0615de8  YETUS-957. maven.sh fails to parse maven version (#99)
0615de8 is described below

commit 0615de8f2381f060af40ba3eeb74e1af95b509b4
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Fri Mar 27 11:44:25 2020 +0900

    YETUS-957. maven.sh fails to parse maven version (#99)
    
    Signed-off-by: Allen Wittenauer <aw...@apache.org>
---
 precommit/src/main/shell/test-patch.d/maven.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/precommit/src/main/shell/test-patch.d/maven.sh b/precommit/src/main/shell/test-patch.d/maven.sh
index aa51cb0..9e8f735 100755
--- a/precommit/src/main/shell/test-patch.d/maven.sh
+++ b/precommit/src/main/shell/test-patch.d/maven.sh
@@ -255,8 +255,12 @@ function maven_precheck
   fi
 
   # finally let folks know what version they'll be dealing with.
-  maven_version=$(${MAVEN} --offline --version 2>/dev/null | head -n 1 2>/dev/null)
-  maven_version=${maven_version##* }
+  # In Maven 3.5.x and 3.6.x, mvn --version contains control characters
+  # even in batch mode. Passing strings command to remove these.
+  maven_version=$("${MAVEN}" "${MAVEN_ARGS[@]}" --offline --version 2>/dev/null \
+    | head -n 1 2>/dev/null \
+    | strings \
+    | cut -d' ' -f3)
   add_version_data maven "${maven_version}"
 }