From df002539f8c12cab9a4ca236be56fa19982fd6cb Mon Sep 17 00:00:00 2001 From: nslqqq Date: Mon, 9 Sep 2013 07:35:57 -0700 Subject: [PATCH 01/17] mvn: enable completion for maven colorizer --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index f367fecce..4f3d40ec9 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -288,5 +288,6 @@ function listMavenCompletions { } compctl -K listMavenCompletions mvn +compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw From e056aee79447bb0f61e33a8901f3a9bfef2d06b9 Mon Sep 17 00:00:00 2001 From: Neil Green Date: Mon, 13 Feb 2017 12:17:06 +0000 Subject: [PATCH 02/17] mvn: enable completion for mvnw --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 4f3d40ec9..d846508d3 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -287,7 +287,7 @@ function listMavenCompletions { ); } -compctl -K listMavenCompletions mvn +compctl -K listMavenCompletions mvn mvnw compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw From 35539fd6e4519eaa9110f160aae7a403478263d2 Mon Sep 17 00:00:00 2001 From: Wajdi Al-Hawari Date: Thu, 17 Sep 2015 13:46:28 -0400 Subject: [PATCH 03/17] mvn: add initialize support in mvn completion --- plugins/mvn/mvn.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index d846508d3..ad0ae0ca0 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -53,6 +53,7 @@ mvn-color() { alias mvn="mvn-or-mvnw" # aliases +alias mvncini='mvn clean initialize' alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' alias mvncist='mvn clean install -DskipTests' @@ -81,7 +82,7 @@ alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { reply=( # common lifecycle - clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + clean initialize process-resources compile process-test-resources test-compile test integration-test package verify install deploy site # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt From 4d4a2fac584e199cc9f15f0431173f376cb674bd Mon Sep 17 00:00:00 2001 From: Alexey Merezhin Date: Fri, 22 Sep 2017 16:19:59 +0200 Subject: [PATCH 04/17] mvn: add mvncp alias to 'mvn clean package' --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index ad0ae0ca0..53136db9c 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -56,6 +56,7 @@ alias mvn="mvn-or-mvnw" alias mvncini='mvn clean initialize' alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' +alias mvncp='mvn clean package' alias mvncist='mvn clean install -DskipTests' alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' From 0dbe7ecedc7631668fdad8ca23d9f19e91b4d0d2 Mon Sep 17 00:00:00 2001 From: sparsick Date: Tue, 31 Jan 2017 10:10:53 +0100 Subject: [PATCH 05/17] mvn: add alias to 'mvn clean deploy' --- plugins/mvn/README.md | 1 + plugins/mvn/mvn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 986ac84a4..be6bd6db3 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -19,6 +19,7 @@ plugins=(... mvn) | `mvne` | `mvn eclipse:eclipse` | | `mvncv` | `mvn clean verify` | | `mvnd` | `mvn deploy` | +| `mvncd` | `mvn clean deploy` | | `mvnp` | `mvn package` | | `mvnc` | `mvn clean` | | `mvncom` | `mvn compile` | diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 53136db9c..9baf66464 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -63,6 +63,7 @@ alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvncv='mvn clean verify' alias mvnd='mvn deploy' +alias mvncd='mvn clean deploy' alias mvnp='mvn package' alias mvnc='mvn clean' alias mvncom='mvn compile' From 7ebd80fc7df544e112480cb9a7ea9d564cbdc160 Mon Sep 17 00:00:00 2001 From: Laurent Vaills Date: Thu, 15 Oct 2015 09:04:32 +0200 Subject: [PATCH 06/17] mvn: add mvncvst alias --- plugins/mvn/mvn.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 9baf66464..edcd10a17 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -62,6 +62,7 @@ alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvncv='mvn clean verify' +alias mvncvst='mvn clean verify -DskipTests' alias mvnd='mvn deploy' alias mvncd='mvn clean deploy' alias mvnp='mvn package' From 283dcab64ffac23e40c80f7fa8bb2e8d06548c50 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:07:31 -0500 Subject: [PATCH 07/17] mvn: colorize [DEBUG] statements in mvn-color --- plugins/mvn/mvn.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index edcd10a17..f4c46bfa1 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -35,7 +35,9 @@ mvn-color() { ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG - LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ From 0a5e69b87eef354e96d8995b786082de7f67c082 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:09:53 -0500 Subject: [PATCH 08/17] mvn: add alias to run maven from a project's subdirectory --- plugins/mvn/mvn.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index f4c46bfa1..7dd3c98dd 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -54,6 +54,9 @@ mvn-color() { # either use orignal mvn oder 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' From 9afaa0c40625a8fa03531efeac6e364d15810e95 Mon Sep 17 00:00:00 2001 From: Bryan Banz Date: Wed, 22 Oct 2014 12:15:29 -0500 Subject: [PATCH 09/17] mvn: add integration-test options to mvn autocomplete --- plugins/mvn/mvn.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7dd3c98dd..28d49d73b 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -90,7 +90,10 @@ alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' function listMavenCompletions { reply=( # common lifecycle - clean initialize process-resources compile process-test-resources test-compile test integration-test package verify install deploy site + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site + + # integration testing + pre-integration-test integration-test # common plugins deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt From 5b569149f33a2eadd29f303a3e2f09d9e3c67c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 17:34:31 +0100 Subject: [PATCH 10/17] mvn: fix formatting --- plugins/mvn/mvn.plugin.zsh | 440 ++++++++++++++++++------------------- 1 file changed, 218 insertions(+), 222 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 28d49d73b..a6cd4edd1 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -22,34 +22,31 @@ RESET_FORMATTING=$(tput sgr0) # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { - if [ -x ./mvnw ] ; then - echo "executing mvnw instead of mvn" - ./mvnw "$@"; + if [ -x ./mvnw ]; then + echo "executing mvnw instead of mvn" + ./mvnw "$@" else - mvn "$@"; + mvn "$@" fi } # Wrapper function for Maven's mvn command. mvn-color() { - ( - # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations - unset LANG - LC_CTYPE=C mvn "$@" | sed \ - -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ - -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" - - # Make sure formatting is reset - echo -ne "${RESET_FORMATTING}" - ) -} + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ + -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" -# Override the mvn command with the colorized one. -#alias mvn="mvn-color" + # Make sure formatting is reset + echo -ne "${RESET_FORMATTING}" + ) +} # either use orignal mvn oder the mvn wrapper alias mvn="mvn-or-mvnw" @@ -77,7 +74,7 @@ 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 mvntc7='mvn tomcat7:run' alias mvntc='mvn tomcat:run' alias mvnjetty='mvn jetty:run' alias mvnboot='mvn spring-boot:run' @@ -87,219 +84,218 @@ alias mvnsrc='mvn dependency:sources' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' -function listMavenCompletions { - reply=( - # common lifecycle - clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site +function listMavenCompletions { + reply=( + # common lifecycle + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site - # integration testing - pre-integration-test integration-test + # integration testing + pre-integration-test integration-test - # common plugins - deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt - # deploy - deploy:deploy-file - # failsafe - failsafe:integration-test failsafe:verify - # install - install:install-file install:help - # site - site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site - # surefire - surefire:test + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file install:help + # site + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site + # surefire + surefire:test - # checkstyle - checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate - # javadoc - javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle - # jxr - jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate - # pmd - pmd:pmd pmd:cpd pmd:check pmd:cpd-check + # checkstyle + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate + # javadoc + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle + # jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check - # ant - ant:ant ant:clean - # antrun - antrun:run - # archetype - archetype:generate archetype:create-from-project archetype:crawl - # assembly - assembly:single assembly:assembly - # dependency - dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies - # enforcer - enforcer:enforce enforcer:display-info - # gpg - gpg:sign gpg:sign-and-deploy-file - # help - help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system - # release - release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions - # jgitflow - jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number - # repository - repository:bundle-create repository:bundle-pack - # source - source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce enforcer:display-info + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork - # eclipse - eclipse:clean eclipse:eclipse - # idea - idea:clean idea:idea + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea - # jetty - jetty:run jetty:run-exploded - # cargo - cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help - # jboss - jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy - # tomcat - tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy - # tomcat6 - tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy - # tomcat7 - tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy - # tomee - tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy - # spring-boot - spring-boot:run spring-boot:repackage - # exec - exec:exec exec:java - # versions - versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert - # scm - scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate - # buildnumber - buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset - # war - war:war war:exploded war:inplace war:manifest - # ear - ear:ear ear:generate-application-xml - # ejb - ejb:ejb - # android - android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices - # nexus - nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download - # repository - repository:bundle-create repository:bundle-pack repository:help + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help - # sonar - sonar:sonar - # license - license:format license:check - # hibernate3 - hibernate3:hbm2ddl hibernate3:help - # liquibase - liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback - # flyway - flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate - # gwt - gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test - # asciidoctor - asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip - # compiler - compiler:compile compiler:testCompile - # resources - resources:resources resources:testResources resources:copy-resources - # verifier - verifier:verify - # jar - jar:jar jar:test-jar - # rar - rar:rar - # acr - acr:acr - # shade - shade:shade - # changelog - changelog:changelog changelog:dev-activity changelog:file-activity - # changes - changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report - # doap - doap:generate - # docck - docck:check - # jdeps - jdeps:jdkinternals jdeps:test-jdkinternals - # linkcheck - linkcheck:linkcheck - # project-info-reports - project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary - # surefire-report - surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only - # invoker - invoker:install invoker:integration-test invoker:verify invoker:run - # jarsigner - jarsigner:sign jarsigner:verify - # patch - patch:apply - # pdf - pdf:pdf - # plugin - plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo - # remote-resources - remote-resources:bundle remote-resources:process - # scm-publish - scm-publish:help scm-publish:publish-scm scm-publish:scmpublish - # stage - stage:copy - # toolchain - toolchain:toolchain - - # options - "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain - # arguments - -am --also-make - -amd --also-make-dependents-am - -B --batch-mode - -b --builder - -C --strict-checksums - -c --lax-checksums - -cpu --check-plugin-updates - -D --define - -e --errors - -emp --encrypt-master-password - -ep --encrypt-password - -f --file - -fae --fail-at-end - -ff --fail-fast - -fn --fail-never - -gs --global-settings - -gt --global-toolchains - -h --help - -l --log-file - -llr --legacy-local-repository - -N --non-recursive - -npr --no-plugin-registry - -npu --no-plugin-updates - -nsu --no-snapshot-updates - -o --offline - -P --activate-profiles - -pl --projects - -q --quiet - -rf --resume-from - -s --settings - -t --toolchains - -T --threads - -U --update-snapshots - -up --update-plugins - -v --version - -V --show-version - -X --debug + # options + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" - cli:execute cli:execute-phase - archetype:generate generate-sources - cobertura:cobertura - -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) - -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) - ); + # arguments + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug + + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + ) } compctl -K listMavenCompletions mvn mvnw compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-or-mvnw - From b767976586a4be87a8e57bbe7feddab9fda097b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 17:35:57 +0100 Subject: [PATCH 11/17] mvn: use echoti instead of tput Avoids forking to tput and some systems don't have tput --- plugins/mvn/mvn.plugin.zsh | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index a6cd4edd1..b557c23e8 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,24 +1,24 @@ # mvn-color based on https://gist.github.com/1027800 -BOLD=$(tput bold) -UNDERLINE_ON=$(tput smul) -UNDERLINE_OFF=$(tput rmul) -TEXT_BLACK=$(tput setaf 0) -TEXT_RED=$(tput setaf 1) -TEXT_GREEN=$(tput setaf 2) -TEXT_YELLOW=$(tput setaf 3) -TEXT_BLUE=$(tput setaf 4) -TEXT_MAGENTA=$(tput setaf 5) -TEXT_CYAN=$(tput setaf 6) -TEXT_WHITE=$(tput setaf 7) -BACKGROUND_BLACK=$(tput setab 0) -BACKGROUND_RED=$(tput setab 1) -BACKGROUND_GREEN=$(tput setab 2) -BACKGROUND_YELLOW=$(tput setab 3) -BACKGROUND_BLUE=$(tput setab 4) -BACKGROUND_MAGENTA=$(tput setab 5) -BACKGROUND_CYAN=$(tput setab 6) -BACKGROUND_WHITE=$(tput setab 7) -RESET_FORMATTING=$(tput sgr0) +BOLD=$(echoti bold) +UNDERLINE_ON=$(echoti smul) +UNDERLINE_OFF=$(echoti rmul) +TEXT_BLACK=$(echoti setaf 0) +TEXT_RED=$(echoti setaf 1) +TEXT_GREEN=$(echoti setaf 2) +TEXT_YELLOW=$(echoti setaf 3) +TEXT_BLUE=$(echoti setaf 4) +TEXT_MAGENTA=$(echoti setaf 5) +TEXT_CYAN=$(echoti setaf 6) +TEXT_WHITE=$(echoti setaf 7) +BACKGROUND_BLACK=$(echoti setab 0) +BACKGROUND_RED=$(echoti setab 1) +BACKGROUND_GREEN=$(echoti setab 2) +BACKGROUND_YELLOW=$(echoti setab 3) +BACKGROUND_BLUE=$(echoti setab 4) +BACKGROUND_MAGENTA=$(echoti setab 5) +BACKGROUND_CYAN=$(echoti setab 6) +BACKGROUND_WHITE=$(echoti setab 7) +RESET_FORMATTING=$(echoti sgr0) # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { From c636e0933a63c85b3c6cef251e1c91d4a8bdb83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 18:28:24 +0100 Subject: [PATCH 12/17] mvn: avoid mvn-or-mvnw function calling itself when mvn is aliased to it --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index b557c23e8..1bc678b74 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -26,7 +26,7 @@ mvn-or-mvnw() { echo "executing mvnw instead of mvn" ./mvnw "$@" else - mvn "$@" + command mvn "$@" fi } From 006b88209872f5f26c57fbb8c0e5d17d5e1ddd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 18:30:38 +0100 Subject: [PATCH 13/17] mvn: clean up mvn-color function --- plugins/mvn/mvn.plugin.zsh | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 1bc678b74..7e31da46a 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,25 +1,3 @@ -# mvn-color based on https://gist.github.com/1027800 -BOLD=$(echoti bold) -UNDERLINE_ON=$(echoti smul) -UNDERLINE_OFF=$(echoti rmul) -TEXT_BLACK=$(echoti setaf 0) -TEXT_RED=$(echoti setaf 1) -TEXT_GREEN=$(echoti setaf 2) -TEXT_YELLOW=$(echoti setaf 3) -TEXT_BLUE=$(echoti setaf 4) -TEXT_MAGENTA=$(echoti setaf 5) -TEXT_CYAN=$(echoti setaf 6) -TEXT_WHITE=$(echoti setaf 7) -BACKGROUND_BLACK=$(echoti setab 0) -BACKGROUND_RED=$(echoti setab 1) -BACKGROUND_GREEN=$(echoti setab 2) -BACKGROUND_YELLOW=$(echoti setab 3) -BACKGROUND_BLUE=$(echoti setab 4) -BACKGROUND_MAGENTA=$(echoti setab 5) -BACKGROUND_CYAN=$(echoti setab 6) -BACKGROUND_WHITE=$(echoti setab 7) -RESET_FORMATTING=$(echoti sgr0) - # if found an executable ./mvnw file execute it otherwise execute orignal mvn mvn-or-mvnw() { if [ -x ./mvnw ]; then @@ -31,13 +9,21 @@ mvn-or-mvnw() { } # 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) + local TEXT_GREEN=$(echoti setaf 2) + local TEXT_YELLOW=$(echoti setaf 3) + local TEXT_BLUE=$(echoti setaf 4) + local TEXT_WHITE=$(echoti setaf 7) + local RESET_FORMATTING=$(echoti sgr0) ( # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations unset LANG LC_CTYPE=C mvn "$@" | sed \ -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ 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 14/17] 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 { From fff756069f678ceda0b7c760b843c09bbc2bc72d Mon Sep 17 00:00:00 2001 From: kubamarchwicki Date: Sun, 1 Jun 2014 21:01:01 +0200 Subject: [PATCH 15/17] mvn: add dynamic profile support to mvn completion * Maven profiles for current pom.xml file * Maven profiles for pom hierarchy * Ommiting comments in profiles --- plugins/mvn/mvn.plugin.zsh | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 66ea548ad..71bba454c 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -68,8 +68,66 @@ alias mvntc='mvn tomcat:run' alias mvntc7='mvn tomcat7:run' alias mvn-updates='mvn versions:display-dependency-updates' +#realpath replacement for iOS - not always present +function _realpath { + if [[ -f "$1" ]] + then + # file *must* exist + if cd "$(echo "${1%/*}")" &>/dev/null + then + # file *may* not be local + # exception is ./file.ext + # try 'cd .; cd -;' *works!* + local tmppwd="$PWD" + cd - &>/dev/null + else + # file *must* be local + local tmppwd="$PWD" + fi + else + # file *cannot* exist + return 1 # failure + fi + + # reassemble realpath + echo "$tmppwd"/"${1##*/}" + return 1 #success +} + +function __pom_hierarchy { + local file=`_realpath "pom.xml"` + POM_HIERARCHY+=("~/.m2/settings.xml") + POM_HIERARCHY+=("$file") + while [ -n "$file" ] && grep -q "" $file; do + ##look for a new relativePath for parent pom.xml + local new_file=`grep -e ".*" $file | sed 's/.*//' | sed 's/<\/relativePath>.*//g'` + + ## is present but not defined. Asume ../pom.xml + if [ -z "$new_file" ]; then + new_file="../pom.xml" + fi + + ## if file exists continue else break + new_pom=`_realpath "${file%/*}/$new_file"` + if [ -n "$new_pom" ]; then + file=$new_pom + else + break + fi + POM_HIERARCHY+=("$file") + done +} function listMavenCompletions { + POM_HIERARCHY=() + __pom_hierarchy + + profiles=() + #current pom profiles + for item in ${POM_HIERARCHY[*]}; do + profiles=($profiles `[ -e $item ] && cat $item | sed 's///' | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?'`) + done + reply=( # common lifecycle clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site @@ -278,7 +336,12 @@ function listMavenCompletions { cobertura:cobertura -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + + $profiles ) + + unset POM_HIERARCHY + unset profiles } compctl -K listMavenCompletions mvn mvnw From f4b2e460c77b79f99831cd048eb0004059c96370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 20:28:32 +0100 Subject: [PATCH 16/17] mvn: fix and cleanup dynamic profiles logic --- plugins/mvn/mvn.plugin.zsh | 78 +++++++++++++------------------------- 1 file changed, 27 insertions(+), 51 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 71bba454c..01aef814d 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -68,64 +68,43 @@ alias mvntc='mvn tomcat:run' alias mvntc7='mvn tomcat7:run' alias mvn-updates='mvn versions:display-dependency-updates' -#realpath replacement for iOS - not always present -function _realpath { - if [[ -f "$1" ]] - then - # file *must* exist - if cd "$(echo "${1%/*}")" &>/dev/null - then - # file *may* not be local - # exception is ./file.ext - # try 'cd .; cd -;' *works!* - local tmppwd="$PWD" - cd - &>/dev/null - else - # file *must* be local - local tmppwd="$PWD" - fi - else - # file *cannot* exist - return 1 # failure + +function listMavenCompletions { + local file new_file + local -a profiles POM_FILES + + # Root POM + POM_FILES=(~/.m2/settings.xml) + + # POM in the current directory + if [[ -f pom.xml ]]; then + local file=pom.xml + POM_FILES+=("${file:A}") fi - # reassemble realpath - echo "$tmppwd"/"${1##*/}" - return 1 #success -} + # Look for POM files in parent directories + while [[ -n "$file" ]] && grep -q "" "$file"; do + # look for a new relativePath for parent pom.xml + new_file=$(grep -e ".*" "$file" | sed -e 's/.*\(.*\)<\/relativePath>.*/\1/') -function __pom_hierarchy { - local file=`_realpath "pom.xml"` - POM_HIERARCHY+=("~/.m2/settings.xml") - POM_HIERARCHY+=("$file") - while [ -n "$file" ] && grep -q "" $file; do - ##look for a new relativePath for parent pom.xml - local new_file=`grep -e ".*" $file | sed 's/.*//' | sed 's/<\/relativePath>.*//g'` - - ## is present but not defined. Asume ../pom.xml - if [ -z "$new_file" ]; then + # if is present but not defined, assume ../pom.xml + if [[ -z "$new_file" ]]; then new_file="../pom.xml" fi - ## if file exists continue else break - new_pom=`_realpath "${file%/*}/$new_file"` - if [ -n "$new_pom" ]; then - file=$new_pom - else + # if file doesn't exist break + file="${file:h}/${new_file}" + if ! [[ -e "$file" ]]; then break fi - POM_HIERARCHY+=("$file") + + POM_FILES+=("${file:A}") done -} -function listMavenCompletions { - POM_HIERARCHY=() - __pom_hierarchy - - profiles=() - #current pom profiles - for item in ${POM_HIERARCHY[*]}; do - profiles=($profiles `[ -e $item ] && cat $item | sed 's///' | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?'`) + # Get profiles from found files + for file in $POM_FILES; do + [[ -e $file ]] || continue + profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?')) done reply=( @@ -339,9 +318,6 @@ function listMavenCompletions { $profiles ) - - unset POM_HIERARCHY - unset profiles } compctl -K listMavenCompletions mvn mvnw From 0e647904ffdd19c697e1c6ab602f65377cb186fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 17 Feb 2019 20:48:13 +0100 Subject: [PATCH 17/17] mvn: update documentation --- plugins/mvn/README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 3f08c56d8..88f5be8ba 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -1,7 +1,7 @@ -## Introduction +# mvn plugin -The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many -[useful aliases](#aliases) as well as completion for the `mvn` command. +The mvn plugin provides many [useful aliases](#aliases) as well as completion for +the [Apache Maven](https://maven.apache.org/) command (`mvn`). Enable it by adding `mvn` to the plugins array in your zshrc file: ```zsh @@ -10,7 +10,7 @@ plugins=(... mvn) ## Aliases -The plugin aliases mvn to a either calls `mvnw` ([Maven Wrapper](https://github.com/takari/maven-wrapper)) +The plugin aliases mvn to a function that calls `mvnw` (the [Maven Wrapper](https://github.com/takari/maven-wrapper)) if it's found, or the mvn command otherwise. | Alias | Command | @@ -46,9 +46,13 @@ if it's found, or the mvn command otherwise. ## 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's a function that wraps the mvn command to colorize it's output. You can use it in place +of the `mvn` command. For example: instead of `mvn test`, use `mvn-color test`. -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). +Since [Maven 3.5.0](https://maven.apache.org/docs/3.5.0/release-notes.html) the mvn command +has colored output, so this function will be soon removed from the plugin. + +### Known bugs + +It has a bug where it will swallow mvn prompts for user input, _e.g._ when using +`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).