Uploaded image for project: 'Jenkins Artifactory Plug-in'
  1. Jenkins Artifactory Plug-in
  2. HAP-1183

When using the 'opts' directive in a declarative pipeline, an error os thrown.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: 4 - Normal
    • Resolution: Done
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.2.3
    • Component/s: None
    • Labels:
      None

      Description

      When using the 'opts' directive in a declarative pipeline, the build fails with the following error:

      Started by user shuki hazan
      Running in Durability level: MAX_SURVIVABILITY
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 41: Invalid parameter "mavenOpts", did you mean "pom"? @ line 41, column 21.
      mavenOpts: '-Dbuild.number=${BUILD_NUMBER}',
      ^

      1 error

      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
      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.lambda$doParse$0(CpsGroovyShell.java:135)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:136)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:132)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
      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.

       

      Steps to reproduce:

      1) Create a pipeline job in jenkins.

      2) configure the pipeline job with the example pipeline from this link: https://raw.githubusercontent.com/jfrog/project-examples/master/jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile

      3) Add the 'opts' directive to the rtMavenRun with a valid value as in the Jenkins artifactory plugin docs:
      rtMavenRun (
          // Tool name from Jenkins configuration.
          tool: MAVEN_TOOL,
          pom: 'maven-example/pom.xml',
          goals: 'clean install',
          // Maven options.
          opts: '-Xms1024m -Xmx4096m',
          resolverId: 'resolver-unique-id'
          deployerId: 'deployer-unique-id',
      )
       
      4) Run the build and you should get the above error.

        Attachments

          Activity

            People

            Assignee:
            eyalb Eyal Ben Moshe
            Reporter:
            shaharl Shahar Levy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: