this script SetupGroovyLib.groovy provide the following:

groovy SetupGroovyLib.groovy -h

Usage SetupGroovyLib jarname [jarname...]
  The jarname is in format of Maven2 artifacts groupId:artifactId:version name.
  You may use site like http://www.mvnrepository.com to help you find the jarname.
  This script default arguments to:
    javax.activation:activation:1.1
    javax.mail:mail:1.4
    mysql:mysql-connector-java:5.1.5
  These jars will allow you to send emails and access to MySQL database!

NOTE: If you are using groovyConsole, you will need to restart it as it won't pick up any new jar added to ~/.groovy/lib automatically.

See also Installing or Update Groovy Automatically

More examples

Using commons-lang

Run groovy SetupGroovyLib.groovy commons-lang:commons-lang:2.3
Now try out:

import org.apache.commons.lang.*
StringUtils.splitByWholeSeparator("aXXbXXc", "XX")