This issue is archived. You can view it, but you can't modify it. Learn more

ExportXMLWordPrintable

      I'm trying to setup a reusable global pipeline library with several test tools with different parameters and experienced the following behaviour with this piece of code:

      node {
          BaseTool st = new MyTool()
          st.number = 1
          st.uid = 10
          st.name = "Joe"
      
          println(st.name)
          echo "foo " + st.displaySomething()
          println(st.displaySomething())
      }
      
      abstract class BaseTool implements Serializable {
          public String name
      
          public BaseTool() {}
      
          abstract void displaySomething()
      }
      
      class MyTool extends BaseTool {
          int number
          int uid
      
          public MyTool() {
              super()
          }
      
          void displaySomething() {
              echo "something"
              println(uid)
          }
      }
      

      I get the following output:

      [Pipeline] node
      Running on master in /var/lib/jenkins/jobs/AbstractTest/workspace
      [Pipeline] {
      [Pipeline] echo
      Joe
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: MyTool.echo() is applicable for argument types: (java.lang.String) values: [something]
      Possible solutions: each(groovy.lang.Closure), getAt(java.lang.String), wait(), any(), every(), dump()
      

      This means, i can't call any pipeline steps and so on from the implemented method.

            Assignee:
            Unassigned
            Reporter:
            Raphael Pionke
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: