745b6550a6a8415e2c6df0006aad40549c3bc56a

Author
Paul N. Baker <paul-nelson-baker@users.noreply.github.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

mvn: run mvnw only if executable (#7326)

The problem that can occur is ocassionally mvnw will not be executable. This can happen if mvnw is included from an archetype, as unix permissions aren't preserved within the jar they're stored in. Only using mvnw if it exists AND is executable

Diff

 1diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
 2index 74583c6dcf9dc9e2b4c8b2fbc993074273c70e2a..f367feccefc9208234a29b46c6efa1dfb99611c1 100644
 3--- a/plugins/mvn/mvn.plugin.zsh
 4+++ b/plugins/mvn/mvn.plugin.zsh
 5@@ -20,9 +20,9 @@ BACKGROUND_CYAN=$(tput setab 6)
 6 BACKGROUND_WHITE=$(tput setab 7)
 7 RESET_FORMATTING=$(tput sgr0)
 8 
 9-# if found a ./mvnw file execute it otherwise execute orignal mvn
10+# if found an executable ./mvnw file execute it otherwise execute orignal mvn
11 mvn-or-mvnw() {
12-	if [ -f ./mvnw ] ; then
13+	if [ -x ./mvnw ] ; then
14 		echo "executing mvnw instead of mvn"		
15 		./mvnw "$@";
16 	else