Coach Thrasher

Monday May 28, 2007

Extendable Maven-BASH Auto Completion

I was so excited about using Maven with bash_completion, I decided to fix it, and add more commands. Now you can support any Maven commands, or plugin commands, including Java "-D" style properties, by appending them to the command set file. You don't need to know BASH shell to make the changes.

Download mvn_completion.zip to get the files, with instructions. It's a 5 minute install.

It really helps with typing long Maven commands, and to jog your memory about what the command options are, with just the [TAB] key.

Something like this:
mvn -Ds[TAB] cl[TAB] co[TAB] int[TAB] ins[TAB] site\:s[TAB] site\:d[TAB]

becomes:
mvn -Dsurefire.useFile=false clean compile integration-test deploy install site\:site site\:deploy

Not sure which hibernate3 goal to run? Just double-tab it ([TAB][TAB]), and all of the options will print out:
$>mvn hibernate3\:[TAB][TAB]
hibernate3:hbm2cfgxml
hibernate3:hbm2ddl
hibernate3:hbm2doc
hibernate3:hbm2hbmxml
hibernate3:hbm2java
hibernate3:schema-export
hibernate3:schema-update

Thanks to Apache for supporting Maven: it rocks.

Fixing Maven 2.x BASH auto completion on CYGWIN

I just figured out how to turn on auto completion for Maven 2.x commands from my cygwin shell on WinXP using bash_completion. The Apache Maven site is getting flushed out with documentation, and they've put up a mini guide for Maven 2.x auto completion. However, it didn't work out the box.

To fix it, I had to:

1) Run the cygwin's "setup.exe" and add the "bash-completion: Bash completion enhancements" package (version 20060301-2) to my cygwin install (bash v3.2.9-10 was already installed).

2) Configure the cygwin bash shell to use bash_completion. I found out how to do this from the cygwin-announce mailing list archive, but I extended their notes to apply the change to all users. It's not enabled by default, even after it's installed, so to add bash_completion for all users, you have to manually edit the /etc/bash.bashrc (usually at "c:/cygwin/etc/bash.bashrc") and add this line:

source /etc/bash_completion

3) Get the auto completion script and follow the instructions to install it to the file:

/etc/bash_completion.d/m2

4) Now, fix a bug in the script which keeps it from running on cygwin. This is the bug:

mvn ecl[TAB]-bash: ${ COMP_WORDS[COMP_CWORD]}: bad substitution

Fix it by editing /etc/bash_completion.d/m2 and changing this line (removing the extra space):

cur=${ COMP_WORDS[COMP_CWORD]}

to this:

cur=${COMP_WORDS[COMP_CWORD]}

Restart the xterm for this to take effect. Now, when you type:

mvn eclip[TAB]

the auto-completion will turn it into:

mvn eclipse:eclipse

Other Maven commands will auto-complete as well. You can add commands for new plugins by editing the m2 file. If you want to really make the auto-completion command set scale for Maven commands, checkout how it's done in GlassFish by Harsha. He has a commands.txt file that is read by the bash_completion.d script for GlassFish. The same thing could be setup for Maven commands.

Yay for saving the fingers from some typing!

Wednesday May 23, 2007

End of the Season

Wow, I can hardly believe it, the rowing season is over. We started off with 8 varsity rowers and 8 novice rowers, and finished with 6 varsity and 6 novice, with two novice coxswains. Nobody was cut from the team, but as often happens with rowing, it's so much work that people naturally opt-out when they need to.

Championships were held at Lake Natoma on Saturday and Sunday. Of the 7 men's boats entered, 4 of them made it through heats to the finals. Those 4 boats were all varsity sculling boats: 1x, 2x, 2x-LT, and 4x. Our MN4+, MV4+, and MN8+ didn't make the finals this year. The sculling boats that made it, did very well. They effectively placed in the top half of all boats in the Southwest USRowing region.

Official results have been posted for Saturday and Sunday. For Palo Alto Rowing Club, our results are as follows:

M2x Heat1: 3/7, Final: 5/6, Overall: 5/13

M2x Lt Heat1: 3/6, Final: 6/6, Overall: 6/11

M1x Heat2: 2/7, Repechage: 1/7, Final: 5/7, Overall: 5/26

M4x Heat2: 2/5, Final: 5/6, Overall: 5/14

MV4+ Heat3: 6/6

MN4+ Heat3: 5/7

MN8+ (this boat included two novice girls to make an 8) Heat2: 7/7

The 2x, which had rigging issues in the last podcast, was fixed by raising the rigging up about 3/8 of an inch using stainless steel washers as a spacer. The boat ran really well with the riggers raised.

I have a considerable amount of video from the regatta that I'll put up on the podcast once I get around to editing it.

Calendar

Feeds

Search

Links

Navigation

Referrers

Loading