improved maven plugin (#6298)

* added some apache maven plugins

added arguments
added longversion of arguments

* SC2006 shellcheck
see https://github.com/koalaman/shellcheck/wiki/SC2006

* SC2068 shellcheck
see https://github.com/koalaman/shellcheck/wiki/SC2068

* SC2086 shellcheck

see https://github.com/koalaman/shellcheck/wiki/SC2086

* shellcheck is not always right ;)
This commit is contained in:
Janosch Knack 2017-09-24 20:19:49 +02:00 committed by Robby Russell
parent d848c94804
commit accdcb2f1c

View File

@ -1,24 +1,24 @@
# mvn-color based on https://gist.github.com/1027800 # mvn-color based on https://gist.github.com/1027800
BOLD=`tput bold` BOLD=$(tput bold)
UNDERLINE_ON=`tput smul` UNDERLINE_ON=$(tput smul)
UNDERLINE_OFF=`tput rmul` UNDERLINE_OFF=$(tput rmul)
TEXT_BLACK=`tput setaf 0` TEXT_BLACK=$(tput setaf 0)
TEXT_RED=`tput setaf 1` TEXT_RED=$(tput setaf 1)
TEXT_GREEN=`tput setaf 2` TEXT_GREEN=$(tput setaf 2)
TEXT_YELLOW=`tput setaf 3` TEXT_YELLOW=$(tput setaf 3)
TEXT_BLUE=`tput setaf 4` TEXT_BLUE=$(tput setaf 4)
TEXT_MAGENTA=`tput setaf 5` TEXT_MAGENTA=$(tput setaf 5)
TEXT_CYAN=`tput setaf 6` TEXT_CYAN=$(tput setaf 6)
TEXT_WHITE=`tput setaf 7` TEXT_WHITE=$(tput setaf 7)
BACKGROUND_BLACK=`tput setab 0` BACKGROUND_BLACK=$(tput setab 0)
BACKGROUND_RED=`tput setab 1` BACKGROUND_RED=$(tput setab 1)
BACKGROUND_GREEN=`tput setab 2` BACKGROUND_GREEN=$(tput setab 2)
BACKGROUND_YELLOW=`tput setab 3` BACKGROUND_YELLOW=$(tput setab 3)
BACKGROUND_BLUE=`tput setab 4` BACKGROUND_BLUE=$(tput setab 4)
BACKGROUND_MAGENTA=`tput setab 5` BACKGROUND_MAGENTA=$(tput setab 5)
BACKGROUND_CYAN=`tput setab 6` BACKGROUND_CYAN=$(tput setab 6)
BACKGROUND_WHITE=`tput setab 7` BACKGROUND_WHITE=$(tput setab 7)
RESET_FORMATTING=`tput sgr0` RESET_FORMATTING=$(tput sgr0)
# Wrapper function for Maven's mvn command. # Wrapper function for Maven's mvn command.
@ -26,15 +26,15 @@ 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 -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/\(\[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 # Make sure formatting is reset
echo -ne ${RESET_FORMATTING} echo -ne "${RESET_FORMATTING}"
) )
} }
# Override the mvn command with the colorized one. # Override the mvn command with the colorized one.
@ -76,18 +76,18 @@ function listMavenCompletions {
# failsafe # failsafe
failsafe:integration-test failsafe:verify failsafe:integration-test failsafe:verify
# install # install
install:install-file install:install-file install:help
# site # site
site:site site:deploy site:run site:stage site:stage-deploy 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 checkstyle:check checkstyle:checkstyle-aggregate
# javadoc # javadoc
javadoc:javadoc javadoc:jar javadoc:aggregate 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: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
@ -100,21 +100,21 @@ function listMavenCompletions {
# 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:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list 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: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: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: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
@ -142,7 +142,7 @@ function listMavenCompletions {
# 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:checkin scm:checkout scm:update scm:status 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
@ -173,17 +173,102 @@ function listMavenCompletions {
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: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 # 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= "-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 # arguments
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X -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 cli:execute cli:execute-phase
archetype:generate generate-sources archetype:generate generate-sources
cobertura:cobertura 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` -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` -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)
); );
} }