Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64515

Classpath of systemGroovyCommand cannot resolve a var

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      The following Job DSL cannot resolve a var passed for the classpath parameter

      stringParam('SHARED_JAR_PATH'
      'file:////Users/cmoullia/temp/demo/lib/build/libs/lib-0.1.0.jar','Path where the shared lib is available n the jenkins instance')
      ...
      postBuildSteps {            
        systemGroovyCommand(readFileFromWorkspace('restorePOM.groovy'))
        systemGroovyCommand(script) { 
         classpath('$SHARED_JAR_PATH')
      }

      Then we got this error

      ERROR: (script, line 101) classpath must be a valid URL: no protocol: $SHARED_JAR_PATH

      As you can see the var name is passed and not extrapolated to get the value

          [JENKINS-64515] Classpath of systemGroovyCommand cannot resolve a var

          Charles Moulliard created issue -
          Charles Moulliard made changes -
          Description Original: {{The following Job DSL cannot resolve a var passed for the classpath parameter}}
          {{}}
          {{}}
          {code:java}
          stringParam('SHARED_JAR_PATH'
          'file:////Users/cmoullia/temp/demo/lib/build/libs/lib-0.1.0.jar','Path where the shared lib is available n the jenkins instance')

          ...

          postBuildSteps {      systemGroovyCommand(readFileFromWorkspace('restorePOM.groovy')) systemGroovyCommand(script) { classpath('$SHARED_JAR_PATH') }{code}
          {{}}
          Then we got this error
          {code:java}
          ERROR: (script, line 101) classpath must be a valid URL: no protocol: $SHARED_JAR_PATH{code}
          As you can see the var name is passed and not extrapolated to get the value
          {{}}
          New: {{The following Job DSL cannot resolve a var passed for the classpath parameter}}


          {code:java}
          stringParam('SHARED_JAR_PATH'
          'file:////Users/cmoullia/temp/demo/lib/build/libs/lib-0.1.0.jar','Path where the shared lib is available n the jenkins instance')
          ...
          postBuildSteps {     
            systemGroovyCommand(readFileFromWorkspace('restorePOM.groovy'))
            systemGroovyCommand(script) {
             classpath('$SHARED_JAR_PATH')
          }{code}
          Then we got this error
          {code:java}
          ERROR: (script, line 101) classpath must be a valid URL: no protocol: $SHARED_JAR_PATH{code}
          As you can see the var name is passed and not extrapolated to get the value
          Jamie Tanna made changes -
          Assignee Original: Daniel Spilker [ daspilker ] New: Jamie Tanna [ jamietanna ]

            jamietanna Jamie Tanna
            cmoulliard Charles Moulliard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: