mvn: sort aliases and improve comments and README

This commit is contained in:
Marc Cornellà 2019-02-17 18:50:46 +01:00
parent 006b882098
commit d0a0421e10
2 changed files with 53 additions and 35 deletions

View file

@ -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 <root>/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).

View file

@ -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 {