From d0a0421e10e222f76c30cdaa04fed2f4911a5272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 18:50:46 +0100 Subject: [PATCH] mvn: sort aliases and improve comments and README --- plugins/mvn/README.md | 45 +++++++++++++++++++++++++++----------- plugins/mvn/mvn.plugin.zsh | 43 ++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 35 deletions(-) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index be6bd6db3..3f08c56d8 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -10,26 +10,45 @@ plugins=(... mvn) ## Aliases +The plugin aliases mvn to a either calls `mvnw` ([Maven Wrapper](https://github.com/takari/maven-wrapper)) +if it's found, or the mvn command otherwise. + | Alias | Command | |:---------------------|:------------------------------------------------| -| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvn!` | `mvn -f /pom.xml` | +| `mvnag` | `mvn archetype:generate` | +| `mvnboot` | `mvn spring-boot:run` | +| `mvnc` | `mvn clean` | +| `mvncd` | `mvn clean deploy` | +| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` | | `mvnci` | `mvn clean install` | +| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvncini` | `mvn clean initialize` | | `mvncist` | `mvn clean install -DskipTests` | | `mvncisto` | `mvn clean install -DskipTests --offline` | -| `mvne` | `mvn eclipse:eclipse` | -| `mvncv` | `mvn clean verify` | -| `mvnd` | `mvn deploy` | -| `mvncd` | `mvn clean deploy` | -| `mvnp` | `mvn package` | -| `mvnc` | `mvn clean` | | `mvncom` | `mvn compile` | +| `mvncp` | `mvn clean package` | | `mvnct` | `mvn clean test` | -| `mvnt` | `mvn test` | -| `mvnag` | `mvn archetype:generate` | -| `mvn-updates` | `mvn versions:display-dependency-updates` | -| `mvntc7` | `mvn tomcat7:run` | -| `mvnjetty` | `mvn jetty:run` | +| `mvncv` | `mvn clean verify` | +| `mvncvst` | `mvn clean verify -DskipTests` | +| `mvnd` | `mvn deploy` | +| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | | `mvndt` | `mvn dependency:tree` | +| `mvne` | `mvn eclipse:eclipse` | +| `mvnjetty` | `mvn jetty:run` | +| `mvnp` | `mvn package` | | `mvns` | `mvn site` | | `mvnsrc` | `mvn dependency:sources` | -| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | +| `mvnt` | `mvn test` | +| `mvntc` | `mvn tomcat:run` | +| `mvntc7` | `mvn tomcat7:run` | +| `mvn-updates` | `mvn versions:display-dependency-updates` | + +## mvn-color + +It's a function that wraps the mvn command to colorize it's output. Since Maven 3.5.0 +the mvn command adds colored output, so this function will be soon removed from the +plugin. + +It also has a bug where it won't print when mvn prompts for user input, _e.g._ when +using `archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052). diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7e31da46a..66ea548ad 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,4 +1,4 @@ -# if found an executable ./mvnw file execute it otherwise execute orignal mvn +# Calls ./mvnw if found, otherwise execute the original mvn mvn-or-mvnw() { if [ -x ./mvnw ]; then echo "executing mvnw instead of mvn" @@ -8,8 +8,7 @@ mvn-or-mvnw() { fi } -# Wrapper function for Maven's mvn command. -# based on https://gist.github.com/1027800 +# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800 mvn-color() { local BOLD=$(echoti bold) local TEXT_RED=$(echoti setaf 1) @@ -34,40 +33,40 @@ mvn-color() { ) } -# either use orignal mvn oder the mvn wrapper +# either use orignal mvn or the mvn wrapper alias mvn="mvn-or-mvnw" # Run mvn against the pom found in a project's root directory (assumes a git repo) alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml' # aliases -alias mvncini='mvn clean initialize' -alias mvncie='mvn clean install eclipse:eclipse' +alias mvnag='mvn archetype:generate' +alias mvnboot='mvn spring-boot:run' +alias mvnc='mvn clean' +alias mvncd='mvn clean deploy' +alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnci='mvn clean install' -alias mvncp='mvn clean package' +alias mvncie='mvn clean install eclipse:eclipse' +alias mvncini='mvn clean initialize' alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' -alias mvne='mvn eclipse:eclipse' -alias mvnce='mvn clean eclipse:clean eclipse:eclipse' +alias mvncom='mvn compile' +alias mvncp='mvn clean package' +alias mvnct='mvn clean test' alias mvncv='mvn clean verify' alias mvncvst='mvn clean verify -DskipTests' alias mvnd='mvn deploy' -alias mvncd='mvn clean deploy' -alias mvnp='mvn package' -alias mvnc='mvn clean' -alias mvncom='mvn compile' -alias mvnct='mvn clean test' -alias mvnt='mvn test' -alias mvnag='mvn archetype:generate' -alias mvn-updates='mvn versions:display-dependency-updates' -alias mvntc7='mvn tomcat7:run' -alias mvntc='mvn tomcat:run' -alias mvnjetty='mvn jetty:run' -alias mvnboot='mvn spring-boot:run' +alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' alias mvndt='mvn dependency:tree' +alias mvne='mvn eclipse:eclipse' +alias mvnjetty='mvn jetty:run' +alias mvnp='mvn package' alias mvns='mvn site' alias mvnsrc='mvn dependency:sources' -alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' +alias mvnt='mvn test' +alias mvntc='mvn tomcat:run' +alias mvntc7='mvn tomcat7:run' +alias mvn-updates='mvn versions:display-dependency-updates' function listMavenCompletions {