Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marcelmaatkamp/341158 to your computer and use it in GitHub Desktop.
Save marcelmaatkamp/341158 to your computer and use it in GitHub Desktop.
Edit your $GROOVY_HOME/conf/groovy-start.conf and add the following line:
load !{user.home}/.groovy/grapes/**.jar
After that your @Grab will work as advertised:
#!/usr/bin/env groovy
@Grab(group='mysql', module='mysql-connector-java', version='5.1.12')
import groovy.sql.Sql
def sql = Sql.newInstance("jdbc:mysql://hostname/database", "username", "password", "com.mysql.jdbc.Driver")
sql.firstRow("select * from users where id=1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment