Forked from marcelmaatkamp/How to enable your local grapes repostory in groovy
Created
July 4, 2017 20:38
-
-
Save outofcoffee/cac4904f0c1ba560e17b94ff85c150c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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