So here are the missing pieces of the puzzle:
- Setup your Gradle build to create a POM and install your jars into your local maven repo
- Add Maven repo support to your Grape configuration. Grape configuration is in ~/.groovy/grapeConfig.xml - and it's an Ivy file in disguise. See [*] below for an example which is down near the bottom of the Grape documentation.
- Install your POM artifacts into Grape. For Groovy SPARQL, the command is: grape install org.codehaus.groovy.sparql groovy-sparql 0.1
- Now you can use Grape, e.g. @Grab('org.codehaus.groovy.sparql:groovy-sparql:0.1')
You can also use grape list to see what jars are now available.
All in all, this makes tools like the Groovy Console an excellent REPL for both Java, Groovy, and presumably other Java polyglot programming.