Reputation: 3678
I am running GroovyConsole on a mac (to launch I just do groovyConsole from the command line). I am a newbie so not sure how I can import needed libraries (jars). For example suppose my groovy script needs apache commons httpclient.
Do I need to specify the jar names in the command line when I open groovyConsole or should I be using Grapes? If it is the latter, I am not sure, the exact syntax of the Grab command. I tried the below and it didn't work...
@Grapes([
@Grab('org.apache:commons-httpclient:3.1'),
@GrabConfig(systemClassLoader = true)])
import org.apache.commons.httpclient.Credentials
Any help would be much appreciated.
Upvotes: 0
Views: 965
Reputation: 171074
You can either do just
@Grab('org.apache:commons-httpclient:3.1')
Or you can add jars from the menu in the groovy console itself
Upvotes: 2