YETUS-957. maven.sh fails to parse maven version (#99)

Signed-off-by: Allen Wittenauer <aw@apache.org>
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 @@
   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}"
 }