3cd8eaf9bb1382ff4f35e614904a4f16553e0dcb

Author
Janosch Schwalm <janosch.schwalm@gmail.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

execute mvnw with "mvn" when mvnw-file is present (#6484)

* executing mvnw, when mvnw-file exists
indriectly enable autocompletion for mvnw

* inform the user :)

Diff

 1diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
 2index d422ba5c7b61c709b7a5a2bbdf901160d641ef1e..74583c6dcf9dc9e2b4c8b2fbc993074273c70e2a 100644
 3--- a/plugins/mvn/mvn.plugin.zsh
 4+++ b/plugins/mvn/mvn.plugin.zsh
 5@@ -20,6 +20,15 @@ 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+mvn-or-mvnw() {
11+	if [ -f ./mvnw ] ; then
12+		echo "executing mvnw instead of mvn"		
13+		./mvnw "$@";
14+	else
15+		mvn "$@";
16+	fi
17+}
18 
19 # Wrapper function for Maven's mvn command.
20 mvn-color() {
21@@ -40,6 +49,9 @@ mvn-color() {
22 # Override the mvn command with the colorized one.
23 #alias mvn="mvn-color"
24 
25+# either use orignal mvn oder the mvn wrapper
26+alias mvn="mvn-or-mvnw"
27+
28 # aliases
29 alias mvncie='mvn clean install eclipse:eclipse'
30 alias mvnci='mvn clean install'
31@@ -276,3 +288,5 @@ function listMavenCompletions {
32 }
33 
34 compctl -K listMavenCompletions mvn
35+compctl -K listMavenCompletions mvn-or-mvnw
36+