Reputation: 21
The script is working fine in groovy console. But when I do check-syntax for the same script in Jenkins, the following error message is coming up -
Script1.groovy: 6: unable to resolve class groovyx.net.http.RESTClient
@ line 6, column 1.
import groovyx.net.http.RESTClient
^
Script1.groovy: 4: unable to resolve class groovyx.net.http.ContentType
@ line 4, column 1.
import groovyx.net.http.ContentType
^
Script1.groovy: 3: unable to resolve class groovyx.net.http.HTTPBuilder
@ line 3, column 1.
import groovyx.net.http.HTTPBuilder....
How to get this issue resolved?
Upvotes: 0
Views: 1497
Reputation: 1143
This exception is because you dont have these dependencies (Jars) that has these classes so you have two option : 1- if you currently using any dependency management framework like (maven,gradle) then just add these dependencies 2- in the groovy file at the top add @Grapes and then add the dependency here an example :
@Grapes(
@Grab(group='yourDependencyGroupID', module='yourDependencyArtifactID'
, version='theDesireVersion')
)
you can search for these dependencies in Maven Repository
i hope this will help :)
Upvotes: 1