424b24761bcb639ee105535d927ff8205f6d2412
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
2index 986ac84a4e83fb713cd3d75f9cd892b137a55123..88f5be8ba3a70e889c6a59246be582f7ce5f0197 100644
3--- a/plugins/mvn/README.md
4+++ b/plugins/mvn/README.md
5@@ -1,7 +1,7 @@
6-## Introduction
7+# mvn plugin
8
9-The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many
10-[useful aliases](#aliases) as well as completion for the `mvn` command.
11+The mvn plugin provides many [useful aliases](#aliases) as well as completion for
12+the [Apache Maven](https://maven.apache.org/) command (`mvn`).
13
14 Enable it by adding `mvn` to the plugins array in your zshrc file:
15 ```zsh
16@@ -10,25 +10,49 @@ plugins=(... mvn)
17
18 ## Aliases
19
20+The plugin aliases mvn to a function that calls `mvnw` (the [Maven Wrapper](https://github.com/takari/maven-wrapper))
21+if it's found, or the mvn command otherwise.
22+
23 | Alias | Command |
24 |:---------------------|:------------------------------------------------|
25-| `mvncie` | `mvn clean install eclipse:eclipse` |
26+| `mvn!` | `mvn -f <root>/pom.xml` |
27+| `mvnag` | `mvn archetype:generate` |
28+| `mvnboot` | `mvn spring-boot:run` |
29+| `mvnc` | `mvn clean` |
30+| `mvncd` | `mvn clean deploy` |
31+| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` |
32 | `mvnci` | `mvn clean install` |
33+| `mvncie` | `mvn clean install eclipse:eclipse` |
34+| `mvncini` | `mvn clean initialize` |
35 | `mvncist` | `mvn clean install -DskipTests` |
36 | `mvncisto` | `mvn clean install -DskipTests --offline` |
37-| `mvne` | `mvn eclipse:eclipse` |
38-| `mvncv` | `mvn clean verify` |
39-| `mvnd` | `mvn deploy` |
40-| `mvnp` | `mvn package` |
41-| `mvnc` | `mvn clean` |
42 | `mvncom` | `mvn compile` |
43+| `mvncp` | `mvn clean package` |
44 | `mvnct` | `mvn clean test` |
45-| `mvnt` | `mvn test` |
46-| `mvnag` | `mvn archetype:generate` |
47-| `mvn-updates` | `mvn versions:display-dependency-updates` |
48-| `mvntc7` | `mvn tomcat7:run` |
49-| `mvnjetty` | `mvn jetty:run` |
50+| `mvncv` | `mvn clean verify` |
51+| `mvncvst` | `mvn clean verify -DskipTests` |
52+| `mvnd` | `mvn deploy` |
53+| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
54 | `mvndt` | `mvn dependency:tree` |
55+| `mvne` | `mvn eclipse:eclipse` |
56+| `mvnjetty` | `mvn jetty:run` |
57+| `mvnp` | `mvn package` |
58 | `mvns` | `mvn site` |
59 | `mvnsrc` | `mvn dependency:sources` |
60-| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
61+| `mvnt` | `mvn test` |
62+| `mvntc` | `mvn tomcat:run` |
63+| `mvntc7` | `mvn tomcat7:run` |
64+| `mvn-updates` | `mvn versions:display-dependency-updates` |
65+
66+## mvn-color
67+
68+It's a function that wraps the mvn command to colorize it's output. You can use it in place
69+of the `mvn` command. For example: instead of `mvn test`, use `mvn-color test`.
70+
71+Since [Maven 3.5.0](https://maven.apache.org/docs/3.5.0/release-notes.html) the mvn command
72+has colored output, so this function will be soon removed from the plugin.
73+
74+### Known bugs
75+
76+It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
77+`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).
78diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
79index f367feccefc9208234a29b46c6efa1dfb99611c1..01aef814d59702199f30a724eb486907719d6662 100644
80--- a/plugins/mvn/mvn.plugin.zsh
81+++ b/plugins/mvn/mvn.plugin.zsh
82@@ -1,292 +1,325 @@
83-# mvn-color based on https://gist.github.com/1027800
84-BOLD=$(tput bold)
85-UNDERLINE_ON=$(tput smul)
86-UNDERLINE_OFF=$(tput rmul)
87-TEXT_BLACK=$(tput setaf 0)
88-TEXT_RED=$(tput setaf 1)
89-TEXT_GREEN=$(tput setaf 2)
90-TEXT_YELLOW=$(tput setaf 3)
91-TEXT_BLUE=$(tput setaf 4)
92-TEXT_MAGENTA=$(tput setaf 5)
93-TEXT_CYAN=$(tput setaf 6)
94-TEXT_WHITE=$(tput setaf 7)
95-BACKGROUND_BLACK=$(tput setab 0)
96-BACKGROUND_RED=$(tput setab 1)
97-BACKGROUND_GREEN=$(tput setab 2)
98-BACKGROUND_YELLOW=$(tput setab 3)
99-BACKGROUND_BLUE=$(tput setab 4)
100-BACKGROUND_MAGENTA=$(tput setab 5)
101-BACKGROUND_CYAN=$(tput setab 6)
102-BACKGROUND_WHITE=$(tput setab 7)
103-RESET_FORMATTING=$(tput sgr0)
104-
105-# if found an executable ./mvnw file execute it otherwise execute orignal mvn
106+# Calls ./mvnw if found, otherwise execute the original mvn
107 mvn-or-mvnw() {
108- if [ -x ./mvnw ] ; then
109- echo "executing mvnw instead of mvn"
110- ./mvnw "$@";
111+ if [ -x ./mvnw ]; then
112+ echo "executing mvnw instead of mvn"
113+ ./mvnw "$@"
114 else
115- mvn "$@";
116+ command mvn "$@"
117 fi
118 }
119
120-# Wrapper function for Maven's mvn command.
121+# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800
122 mvn-color() {
123- (
124- # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
125- unset LANG
126- LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
127- -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
128- -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
129- -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \