1012e1
_m2_make_goals()
1012e1
{
1012e1
  plugin=$1
1012e1
  mojos=$2
1012e1
  for mojo in $mojos
1012e1
  do
1012e1
    export goals="$goals $plugin:$mojo"
1012e1
  done
1012e1
}
1012e1
1012e1
_m2_complete()
1012e1
{
1012e1
  local cur goals
1012e1
1012e1
  COMPREPLY=()
1012e1
  cur="${COMP_WORDS[COMP_CWORD]}"
1012e1
  prev="${COMP_WORDS[COMP_CWORD-1]}"
1012e1
1012e1
  case "${prev}" in
1012e1
       -f | --file|-l|--log-file)
1012e1
              COMPREPLY=( $(compgen -f ${cur}) )
1012e1
              return 0
1012e1
       ;;
1012e1
       *);;
1012e1
  esac
1012e1
1012e1
1012e1
  goals='clean compile test install package deploy site verify'
1012e1
  if [[ ${cur} == -* ]] ; then
1012e1
     goals="$goals -am --also-make
1012e1
                   -amd --also-make-dependents
1012e1
                   -B --batch-mode
1012e1
                   -C --strict-checksums
1012e1
                   -c --lax-checksums
1012e1
                   -cpu --check-plugin-updates
1012e1
                   -D --define
1012e1
                   -e --errors
1012e1
                   -emp --encrypt-master-password
1012e1
                   -ep --encrypt-password
1012e1
                   -f --file
1012e1
                   -fae --fail-at-end
1012e1
                   -ff --fail-fast
1012e1
                   -fn --fail-never
1012e1
                   -gs --global-settings
1012e1
                   -h --help
1012e1
                   -l --log-file
1012e1
                   -N --non-recursive
1012e1
                   -npr --no-plugin-registry
1012e1
                   -npu --no-plugin-updates
1012e1
                   -nsu --no-snapshot-updates
1012e1
                   -o --offline
1012e1
                   -P --activate-profiles
1012e1
                   -pl --projects
1012e1
                   -q --quiet
1012e1
                   -rf --resume-from
1012e1
                   -s --settings
1012e1
                   -T --threads
1012e1
                   -t --toolchains
1012e1
                   -U --update-snapshots
1012e1
                   -up --update-plugins
1012e1
                   -V --show-version
1012e1
                   -v --version
1012e1
                   -X --debug
1012e1
                   -Dmaven.test.skip=true
1012e1
                   -Dmaven.compiler.source=1.5
1012e1
                   -Dmaven.compiler.source=1.6
1012e1
                   -Dmaven.compiler.source=1.7
1012e1
                   -Dmaven.compiler.target=1.5
1012e1
                   -Dmaven.compiler.target=1.6
1012e1
                   -Dmaven.compiler.target=1.7
1012e1
                   -Dproject.build.sourceEncoding=UTF-8
1012e1
                   -Dmaven.repo.local=
1012e1
                   -Dmaven.local.depmap.file=
1012e1
                   -Dmaven.local.debug=true
1012e1
                   -Dmaven.local.mode=true"
1012e1
  fi
1012e1
1012e1
  goals=$goals _m2_make_goals "eclipse" "eclipse"
1012e1
  goals=$goals _m2_make_goals "idea" "idea"
1012e1
  goals=$goals _m2_make_goals "assembly" "assembly"
1012e1
  goals=$goals _m2_make_goals "plexus" "app bundle-application bundle-runtime descriptor runtime service"
1012e1
  goals=$goals _m2_make_goals "dependency" "analyze analyze-dep-mgt analyze-only analyze-report analyze-duplicate
1012e1
                                           build-classpath copy copy-dependencies get go-offline list properties
1012e1
                                           purge-local-repository resolve resolve-plugins sources tree unpack
1012e1
                                           unpack-dependencies"
1012e1
  cur=`echo $cur | sed 's/\\\\//g'`
1012e1
  COMPREPLY=($(compgen -W "${goals}" -- ${cur} | sed 's/\\\\//g') )
1012e1
}
1012e1
1012e1
complete -F _m2_complete -o filenames mvn