------ Guide to Maven 2.x auto completion using BASH ------ Trygve Laugstol Jason van Zyl ------ 2005-10-12 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Guide to Maven 2.x auto completion using BASH First you must go to the following site to install the BASH programmable auto completion setup if your distro doesn't have it by default. I don't think many do so you'll need to go to the {{{http://www.caliban.org/bash/index.shtml#completion}Programmable Completion Website}}. Once you've setup your system for auto completion you need to take the following: +----+ #!/bin/bash _m2_make_goals() { plugin=$1 mojos=$2 for mojo in $mojos do export goals="$goals $plugin:$mojo" done } _m2_complete() { local cur goals COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} goals='clean compile test install package deploy site' goals=$goals _m2_make_goals "eclipse" "eclipse" goals=$goals _m2_make_goals "idea" "idea" goals=$goals _m2_make_goals "assembly" "assembly" goals=$goals _m2_make_goals "plexus" "app bundle-application bundle-runtime descriptor runtime service" cur=`echo $cur | sed 's/\\\\//g'` COMPREPLY=($(compgen -W "${goals}" ${cur} | sed 's/\\\\//g') ) } complete -F _m2_complete -o filenames mvn +----+ And place it in <<>>. Once you've done that the next time you start up your BASH shell you will have m2 auto completion!