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

Token macro expansion for the system groovy build step classpath

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • groovy-plugin
    • None
    • Red Hat Enterprise Linux Server release 5.3 (Tikanga)
      java version "1.6.0_11"
      Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
      Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)
      Jenkins ver. 1.509.1

      The classpath setting for the system groovy build step does currently not support token macro expansion. What I would like to do is put a jar on the classpath which is in the workspace of a job or somewhere under JENKINS_HOME. This can't be done with the version 1.13. of the plugin.

          [JENKINS-18112] Token macro expansion for the system groovy build step classpath

          Here is an example of how this feature could be useful.

          First create a groovy script that imports a class, call this script "caller.groovy":

          import JenkinsSystemGroovy
          def j = new JenkinsSystemGroovy(out)
          

          Next create the file that contains the class, call this file "JenkinsSystemGroovy.groovy":

          class JenkinsSystemGroovy {
            def JenkinsSystemGroovy(out) {
              out.println("Hello")
            }
          }
          

          Get those two files in the workspace (for example, your workspace could contain a git clone of your work that includes those files).

          Next we want to run the caller.groovy script as a System Groovy Script in the Build phase, so we configure the build phase as such:

          Execute system Groovy script
          [ ] Groovy command
          [x] Groovy script file
          caller.groovy
          Variable bindings: (leave empty)
          Classpath: $WORKSPACE
          

          This fails on the import. This bug report is about making this possible.

          Martin d'Anjou added a comment - Here is an example of how this feature could be useful. First create a groovy script that imports a class, call this script "caller.groovy": import JenkinsSystemGroovy def j = new JenkinsSystemGroovy(out) Next create the file that contains the class, call this file "JenkinsSystemGroovy.groovy": class JenkinsSystemGroovy { def JenkinsSystemGroovy(out) { out.println("Hello") } } Get those two files in the workspace (for example, your workspace could contain a git clone of your work that includes those files). Next we want to run the caller.groovy script as a System Groovy Script in the Build phase, so we configure the build phase as such: Execute system Groovy script [ ] Groovy command [x] Groovy script file caller.groovy Variable bindings: (leave empty) Classpath: $WORKSPACE This fails on the import. This bug report is about making this possible.

            vjuranek vjuranek
            wgreven Wilco Greven
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: