How to define and get/put the values in Jenkinsfile groovy mapHow to escape XML characters in a groovy Jenkinsfile without calling static methodhow to use publish over ssh on Jenkinsfile and scp using groovy SDL on Jenkinsfile?Jenkinsfile 'parallel' directiveHow to import groovy package/class into pipeline?Scripted jenkinsfile parallel stageJenkins Pipeline - java.lang.NoSuchMethodError: No such DSL method 'lock' found among stepsNo such DSL method 'publishHTML' found among stepsJenkins parallel execution in Jenkins not executed properlyMultiple Jenkinsfiles, One Agent LabelJenkins scripted pipeline NoSuchMethodError: No such DSL method 'setLatestRevision' found among steps

Initiative: Do I lose my attack/action if my target moves or dies before my turn in combat?

Don’t seats that recline flat defeat the purpose of having seatbelts?

Can I criticise the more senior developers around me for not writing clean code?

Multiple options vs single option UI

How to write a column outside the braces in a matrix?

Why do games have consumables?

can anyone help me with this awful query plan?

Why does nature favour the Laplacian?

What's the polite way to say "I need to urinate"?

Why does Mind Blank stop the Feeblemind spell?

'It addicted me, with one taste.' Can 'addict' be used transitively?

Function pointer with named arguments?

Critique of timeline aesthetic

How to limit Drive Letters Windows assigns to new removable USB drives

How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?

Constructions of PRF (Pseudo Random Function)

Can't get 5V 3A DC constant

Did the BCPL programming language support floats?

a sore throat vs a strep throat vs strep throat

How to not starve gigantic beasts

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

Was there a shared-world project before "Thieves World"?

Two field separators (colon and space) in awk

How did Captain America manage to do this?



How to define and get/put the values in Jenkinsfile groovy map


How to escape XML characters in a groovy Jenkinsfile without calling static methodhow to use publish over ssh on Jenkinsfile and scp using groovy SDL on Jenkinsfile?Jenkinsfile 'parallel' directiveHow to import groovy package/class into pipeline?Scripted jenkinsfile parallel stageJenkins Pipeline - java.lang.NoSuchMethodError: No such DSL method 'lock' found among stepsNo such DSL method 'publishHTML' found among stepsJenkins parallel execution in Jenkins not executed properlyMultiple Jenkinsfiles, One Agent LabelJenkins scripted pipeline NoSuchMethodError: No such DSL method 'setLatestRevision' found among steps






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have this Jenkinsfile below. I am trying to get the key of a map but I am getting "java.lang.NoSuchMethodError: No such DSL method 'get' found among steps". Can someone help me to resolve this?



def country_capital = 
[Australia : [best: 'xx1', good: 'xx2', bad: 'xx3'],
America : [best: 'yy1', good: 'yy2', bad: 'yy3']]


pipeline
agent any
stages
stage('Test Map')
steps
script
echo country_capital.get('Australia')['best']














share|improve this question






























    1















    I have this Jenkinsfile below. I am trying to get the key of a map but I am getting "java.lang.NoSuchMethodError: No such DSL method 'get' found among steps". Can someone help me to resolve this?



    def country_capital = 
    [Australia : [best: 'xx1', good: 'xx2', bad: 'xx3'],
    America : [best: 'yy1', good: 'yy2', bad: 'yy3']]


    pipeline
    agent any
    stages
    stage('Test Map')
    steps
    script
    echo country_capital.get('Australia')['best']














    share|improve this question


























      1












      1








      1








      I have this Jenkinsfile below. I am trying to get the key of a map but I am getting "java.lang.NoSuchMethodError: No such DSL method 'get' found among steps". Can someone help me to resolve this?



      def country_capital = 
      [Australia : [best: 'xx1', good: 'xx2', bad: 'xx3'],
      America : [best: 'yy1', good: 'yy2', bad: 'yy3']]


      pipeline
      agent any
      stages
      stage('Test Map')
      steps
      script
      echo country_capital.get('Australia')['best']














      share|improve this question
















      I have this Jenkinsfile below. I am trying to get the key of a map but I am getting "java.lang.NoSuchMethodError: No such DSL method 'get' found among steps". Can someone help me to resolve this?



      def country_capital = 
      [Australia : [best: 'xx1', good: 'xx2', bad: 'xx3'],
      America : [best: 'yy1', good: 'yy2', bad: 'yy3']]


      pipeline
      agent any
      stages
      stage('Test Map')
      steps
      script
      echo country_capital.get('Australia')['best']











      jenkins groovy jenkins-pipeline






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 8:54









      daspilker

      6,1591739




      6,1591739










      asked Mar 8 at 18:19









      user3847894user3847894

      1602212




      1602212






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You can get the value using this way



          def country_capital = [
          Australia: [
          best: 'xx1',
          good: 'xx2',
          bad: 'xx3'
          ],
          America: [
          best: 'yy1',
          good: 'yy2',
          bad: 'yy3'
          ]
          ]

          pipeline
          agent any
          stages
          stage('Test Map')
          steps
          script
          echo country_capital['Australia'].best







          // Output
          xx1





          share|improve this answer

























          • That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

            – user3847894
            Mar 9 at 4:48











          • Perfect. Now it is working just fine.

            – user3847894
            Mar 9 at 8:22











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068879%2fhow-to-define-and-get-put-the-values-in-jenkinsfile-groovy-map%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You can get the value using this way



          def country_capital = [
          Australia: [
          best: 'xx1',
          good: 'xx2',
          bad: 'xx3'
          ],
          America: [
          best: 'yy1',
          good: 'yy2',
          bad: 'yy3'
          ]
          ]

          pipeline
          agent any
          stages
          stage('Test Map')
          steps
          script
          echo country_capital['Australia'].best







          // Output
          xx1





          share|improve this answer

























          • That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

            – user3847894
            Mar 9 at 4:48











          • Perfect. Now it is working just fine.

            – user3847894
            Mar 9 at 8:22















          2














          You can get the value using this way



          def country_capital = [
          Australia: [
          best: 'xx1',
          good: 'xx2',
          bad: 'xx3'
          ],
          America: [
          best: 'yy1',
          good: 'yy2',
          bad: 'yy3'
          ]
          ]

          pipeline
          agent any
          stages
          stage('Test Map')
          steps
          script
          echo country_capital['Australia'].best







          // Output
          xx1





          share|improve this answer

























          • That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

            – user3847894
            Mar 9 at 4:48











          • Perfect. Now it is working just fine.

            – user3847894
            Mar 9 at 8:22













          2












          2








          2







          You can get the value using this way



          def country_capital = [
          Australia: [
          best: 'xx1',
          good: 'xx2',
          bad: 'xx3'
          ],
          America: [
          best: 'yy1',
          good: 'yy2',
          bad: 'yy3'
          ]
          ]

          pipeline
          agent any
          stages
          stage('Test Map')
          steps
          script
          echo country_capital['Australia'].best







          // Output
          xx1





          share|improve this answer















          You can get the value using this way



          def country_capital = [
          Australia: [
          best: 'xx1',
          good: 'xx2',
          bad: 'xx3'
          ],
          America: [
          best: 'yy1',
          good: 'yy2',
          bad: 'yy3'
          ]
          ]

          pipeline
          agent any
          stages
          stage('Test Map')
          steps
          script
          echo country_capital['Australia'].best







          // Output
          xx1






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 9 at 7:33

























          answered Mar 8 at 18:31









          Mostafa HusseinMostafa Hussein

          5,16731338




          5,16731338












          • That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

            – user3847894
            Mar 9 at 4:48











          • Perfect. Now it is working just fine.

            – user3847894
            Mar 9 at 8:22

















          • That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

            – user3847894
            Mar 9 at 4:48











          • Perfect. Now it is working just fine.

            – user3847894
            Mar 9 at 8:22
















          That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

          – user3847894
          Mar 9 at 4:48





          That is working but it seems very complex. I know I can get the value using get method. Do you know anything about that?

          – user3847894
          Mar 9 at 4:48













          Perfect. Now it is working just fine.

          – user3847894
          Mar 9 at 8:22





          Perfect. Now it is working just fine.

          – user3847894
          Mar 9 at 8:22



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068879%2fhow-to-define-and-get-put-the-values-in-jenkinsfile-groovy-map%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович