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

"Accessing steps" again. Now "No tool named Maven found"

      I trying to use an example from docs . Copy and paste both of

      class Utilities implements Serializable {
           def steps     Utilities(steps) {{color:#000043}this.steps = steps}
           def mvn(args) {
           steps.sh "${steps.tool 'Maven'{color}}/bin/mvn -o ${args}"     }
      }

      and

      @Library('lib@trunk/pipelines/jlib/trunk') _
      import derivative.Utilities
      def utils = new Utilities(this)
      node {
           stage ('some') {
           utils.mvn 'clean package'    }
      }

      and then get the following output:

      ERROR: No tool named Maven found

      I have tried to susbstitute 'Maven' to 'git' , because i'd like to pass git into shared lib. But getting same message:

      ERROR: No tool named git found

      I cannot understand, what exactly is steps.sh? Is it bash script?

          [JENKINS-61177] "Accessing steps" again. Now "No tool named Maven found"

          gek created issue -
          gek made changes -
          Description Original: I trying to use an [example | [https://jenkins.io/doc/book/pipeline/shared-libraries/#accessing-steps] ]from docs. Copy and paste both of
          {quote}{color:#000043}class {color}Utilities {color:#000043}implements {color}Serializable {
               {color:#000043}def {color}{color:#660e7a}steps
          {color}     Utilities(steps) {{color:#000043}this{color}.{color:#660e7a}steps {color}= steps}
               {color:#000043}def {color}mvn(args) {
               {color:#660e7a}steps{color}.sh {color:#008000}"{color}$\{steps.tool {color:#008000}'Maven'{color}}{color:#008000}/bin/mvn -o {color}${args}{color:#008000}"
          {color}     }
          }{quote}
          {quote}and{quote}
          {quote}{color:#808000}@{color}Library({color:#008000}'lib@trunk/pipelines/jlib/trunk'{color}) _
          {color:#000043}import {color}derivative.Utilities
          {color:#000043}def {color}utils = {color:#000043}new {color}Utilities({color:#000043}this{color})
          {color:#808080}
          {color}node {
               stage ({color:#008000}'some'{color}) {
               utils.mvn {color:#008000}'clean package'
          {color}    }
          }{quote}
          and then get the following output:
          {quote}ERROR: No tool named Maven found
          {quote}
          I have tried to susbstitute 'Maven' to 'git' , because i'd like to pass git into shared lib. But getting same message:
          {quote}ERROR: No tool named git found
          {quote}
          I cannot understand, what exactly is {color:#660e7a}steps{color}.sh? Is it bash script?
          New: I trying to use an example from [docs|https://jenkins.io/doc/book/pipeline/shared-libraries/#accessing-steps] . Copy and paste both of
          {quote}{color:#000043}class {color}Utilities {color:#000043}implements {color}Serializable {
               {color:#000043}def {color}{color:#660e7a}steps
          {color}     Utilities(steps) {{color:#000043}this{color}.{color:#660e7a}steps {color}= steps}
               {color:#000043}def {color}mvn(args) {
               {color:#660e7a}steps{color}.sh {color:#008000}"{color}$\{steps.tool {color:#008000}'Maven'{color}}{color:#008000}/bin/mvn -o {color}${args}{color:#008000}"
          {color}     }
          }{quote}
          {quote}and{quote}
          {quote}{color:#808000}@{color}Library({color:#008000}'lib@trunk/pipelines/jlib/trunk'{color}) _
          {color:#000043}import {color}derivative.Utilities
          {color:#000043}def {color}utils = {color:#000043}new {color}Utilities({color:#000043}this{color})
          {color:#808080}
          {color}node {
               stage ({color:#008000}'some'{color}) {
               utils.mvn {color:#008000}'clean package'
          {color}    }
          }{quote}
          and then get the following output:
          {quote}ERROR: No tool named Maven found
          {quote}
          I have tried to susbstitute 'Maven' to 'git' , because i'd like to pass git into shared lib. But getting same message:
          {quote}ERROR: No tool named git found
          {quote}
          I cannot understand, what exactly is {color:#660e7a}steps{color}.sh? Is it bash script?

            Unassigned Unassigned
            gek gek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: