Use `\\'` instead of `$` in auto-mode-alist.

That is the suggestion at emacs wiki [1].

Also in my system (archlinux) `\\.groovy$` does not seem to work while `\\.groovy\\'` does even though file names do _not_ contain new line characters.

[1] http://www.emacswiki.org/emacs/AutoModeAlist