mvn: fix formatting

This commit is contained in:
Marc Cornellà 2019-02-17 17:34:31 +01:00
parent 9afaa0c406
commit 5b569149f3

View file

@ -22,34 +22,31 @@ RESET_FORMATTING=$(tput sgr0)
# if found an executable ./mvnw file execute it otherwise execute orignal mvn # if found an executable ./mvnw file execute it otherwise execute orignal mvn
mvn-or-mvnw() { mvn-or-mvnw() {
if [ -x ./mvnw ] ; then if [ -x ./mvnw ]; then
echo "executing mvnw instead of mvn" echo "executing mvnw instead of mvn"
./mvnw "$@"; ./mvnw "$@"
else else
mvn "$@"; mvn "$@"
fi fi
} }
# Wrapper function for Maven's mvn command. # Wrapper function for Maven's mvn command.
mvn-color() { mvn-color() {
( (
# Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
unset LANG unset LANG
LC_CTYPE=C mvn "$@" | sed \ LC_CTYPE=C mvn "$@" | sed \
-e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ -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_RED}${BOLD}\1${RESET_FORMATTING}\2/g" \
-e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/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/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
-e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\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" -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}"
)
}
# Override the mvn command with the colorized one. # Make sure formatting is reset
#alias mvn="mvn-color" echo -ne "${RESET_FORMATTING}"
)
}
# either use orignal mvn oder the mvn wrapper # either use orignal mvn oder the mvn wrapper
alias mvn="mvn-or-mvnw" alias mvn="mvn-or-mvnw"
@ -77,7 +74,7 @@ alias mvnct='mvn clean test'
alias mvnt='mvn test' alias mvnt='mvn test'
alias mvnag='mvn archetype:generate' alias mvnag='mvn archetype:generate'
alias mvn-updates='mvn versions:display-dependency-updates' alias mvn-updates='mvn versions:display-dependency-updates'
alias mvntc7='mvn tomcat7:run' alias mvntc7='mvn tomcat7:run'
alias mvntc='mvn tomcat:run' alias mvntc='mvn tomcat:run'
alias mvnjetty='mvn jetty:run' alias mvnjetty='mvn jetty:run'
alias mvnboot='mvn spring-boot:run' alias mvnboot='mvn spring-boot:run'
@ -87,219 +84,218 @@ alias mvnsrc='mvn dependency:sources'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc' alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
function listMavenCompletions { function listMavenCompletions {
reply=( reply=(
# common lifecycle # common lifecycle
clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site
# integration testing # integration testing
pre-integration-test integration-test pre-integration-test integration-test
# common plugins # 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 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:deploy-file deploy:deploy-file
# failsafe # failsafe
failsafe:integration-test failsafe:verify failsafe:integration-test failsafe:verify
# install # install
install:install-file install:help install:install-file install:help
# site # site
site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site
# surefire # surefire
surefire:test surefire:test
# checkstyle # checkstyle
checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate
# javadoc # 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 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 jxr:aggregate jxr:test-jxr jxr:test-aggregate jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate
# pmd # pmd
pmd:pmd pmd:cpd pmd:check pmd:cpd-check pmd:pmd pmd:cpd pmd:check pmd:cpd-check
# ant # ant
ant:ant ant:clean ant:ant ant:clean
# antrun # antrun
antrun:run antrun:run
# archetype # archetype
archetype:generate archetype:create-from-project archetype:crawl archetype:generate archetype:create-from-project archetype:crawl
# assembly # assembly
assembly:single assembly:assembly assembly:single assembly:assembly
# dependency # 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 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
enforcer:enforce enforcer:display-info enforcer:enforce enforcer:display-info
# gpg # gpg
gpg:sign gpg:sign-and-deploy-file gpg:sign gpg:sign-and-deploy-file
# help # help
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
# release # release
release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions
# jgitflow # jgitflow
jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number
# repository # repository
repository:bundle-create repository:bundle-pack repository:bundle-create repository:bundle-pack
# source # source
source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork
# eclipse # eclipse
eclipse:clean eclipse:eclipse eclipse:clean eclipse:eclipse
# idea # idea
idea:clean idea:idea idea:clean idea:idea
# jetty # jetty
jetty:run jetty:run-exploded jetty:run jetty:run-exploded
# cargo # cargo
cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
# jboss # jboss
jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
# tomcat # tomcat
tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
# tomcat6 # tomcat6
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
# tomcat7 # tomcat7
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
# tomee # tomee
tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
# spring-boot # spring-boot
spring-boot:run spring-boot:repackage spring-boot:run spring-boot:repackage
# exec # exec
exec:exec exec:java exec:exec exec:java
# versions # 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 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
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 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
buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
# war # war
war:war war:exploded war:inplace war:manifest war:war war:exploded war:inplace war:manifest
# ear # ear
ear:ear ear:generate-application-xml ear:ear ear:generate-application-xml
# ejb # ejb
ejb:ejb ejb:ejb
# android # 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 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
nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download 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
repository:bundle-create repository:bundle-pack repository:help repository:bundle-create repository:bundle-pack repository:help
# sonar # sonar
sonar:sonar sonar:sonar
# license # license
license:format license:check license:format license:check
# hibernate3 # hibernate3
hibernate3:hbm2ddl hibernate3:help hibernate3:hbm2ddl hibernate3:help
# liquibase # 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 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
flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
# gwt # 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 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
asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip
# compiler # compiler
compiler:compile compiler:testCompile compiler:compile compiler:testCompile
# resources # resources
resources:resources resources:testResources resources:copy-resources resources:resources resources:testResources resources:copy-resources
# verifier # verifier
verifier:verify verifier:verify
# jar # jar
jar:jar jar:test-jar jar:jar jar:test-jar
# rar # rar
rar:rar rar:rar
# acr # acr
acr:acr acr:acr
# shade # shade
shade:shade shade:shade
# changelog # changelog
changelog:changelog changelog:dev-activity changelog:file-activity changelog:changelog changelog:dev-activity changelog:file-activity
# changes # 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 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
doap:generate doap:generate
# docck # docck
docck:check docck:check
# jdeps # jdeps
jdeps:jdkinternals jdeps:test-jdkinternals jdeps:jdkinternals jdeps:test-jdkinternals
# linkcheck # linkcheck
linkcheck:linkcheck linkcheck:linkcheck
# project-info-reports # 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 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
surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only
# invoker # invoker
invoker:install invoker:integration-test invoker:verify invoker:run invoker:install invoker:integration-test invoker:verify invoker:run
# jarsigner # jarsigner
jarsigner:sign jarsigner:verify jarsigner:sign jarsigner:verify
# patch # patch
patch:apply patch:apply
# pdf # pdf
pdf:pdf pdf:pdf
# plugin # plugin
plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo
# remote-resources # remote-resources
remote-resources:bundle remote-resources:process remote-resources:bundle remote-resources:process
# scm-publish # scm-publish
scm-publish:help scm-publish:publish-scm scm-publish:scmpublish scm-publish:help scm-publish:publish-scm scm-publish:scmpublish
# stage # stage
stage:copy stage:copy
# toolchain # toolchain
toolchain: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="
# arguments # options
-am --also-make "-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="
-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 # arguments
archetype:generate generate-sources -am --also-make
cobertura:cobertura -amd --also-make-dependents-am
-Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) -B --batch-mode
-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) -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 mvnw
compctl -K listMavenCompletions mvn-color compctl -K listMavenCompletions mvn-color
compctl -K listMavenCompletions mvn-or-mvnw compctl -K listMavenCompletions mvn-or-mvnw