Quero rodar um pipeline em groovy no jenkins no qual uso umas dependencias da AWS. Para gerenciar as depencias utilizo o ivy-2.4.0.jar
JENKINS_HOME/war/WEB-INF/lib/ivy-2.4.0.jar
Meu Jenkins roda num container do docker (imagem jenkins:2.164.3)
Pra declarar as dependecnias no script pipeline.groovy utilizo o @Grapes:
// https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk
@Grapes(
@Grab(group='com.amazonaws', module='aws-java-sdk', version='1.11.572')
)
import com.amazonaws.regions.Regions;
import com.amazonaws.services.apigateway.AmazonApiGateway;
import com.amazonaws.services.apigateway.AmazonApiGatewayClientBuilder;
import com.amazonaws.services.apigateway.model.Deployment;
import com.amazonaws.services.apigateway.model.GetDeploymentsRequest;
import com.amazonaws.services.apigateway.model.GetDeploymentsResult;
node('master') {
// comands
}
Ao rodar o script recebo:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 16: unable to resolve class com.amazonaws.services.apigateway.model.GetDeploymentsRequest
@ line 16, column 1.
import com.amazonaws.services.apigateway.model.GetDeploymentsRequest;
^
WorkflowScript: 17: unable to resolve class com.amazonaws.services.apigateway.model.GetDeploymentsResult
@ line 17, column 1.
import com.amazonaws.services.apigateway.model.GetDeploymentsResult;
^
WorkflowScript: 14: unable to resolve class com.amazonaws.services.apigateway.AmazonApiGatewayClientBuilder
@ line 14, column 1.
import com.amazonaws.services.apigateway.AmazonApiGatewayClientBuilder;
^
WorkflowScript: 15: unable to resolve class com.amazonaws.services.apigateway.model.Deployment
@ line 15, column 1.
import com.amazonaws.services.apigateway.model.Deployment;
^
WorkflowScript: 12: unable to resolve class com.amazonaws.regions.Regions
@ line 12, column 1.
import com.amazonaws.regions.Regions;
^
WorkflowScript: 13: unable to resolve class com.amazonaws.services.apigateway.AmazonApiGateway
@ line 13, column 1.
import com.amazonaws.services.apigateway.AmazonApiGateway;
^
6 errors
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:554)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:126)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:320)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE