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

Classpath of systemGroovyCommand cannot resolve a var

XMLWordPrintable

    • 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

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

              Created:
              Updated: