Error Jenkins pipeline No such DSL method

0 votes

I ran the following code by using a Jenkins pipeline, but I always get an error. What am I missing?

node {
   stage 'test'
   def whatThe = someFunc('textToFunc')
   {def whatThe2 = someFunc2('textToFunc2')}
}
def someFunc(String text){
    echo text
    text
}
def someFunc2(String text2){
    echo text2
    text2
}

Error:

java.lang.NoSuchMethodError: **No such DSL method 'someFunc'**
Aug 17, 2018 in Jenkins by Tyrion anex
• 8,700 points
23,582 views
It's a syntax error! Check your  someFunc syntax

1 answer to this question.

0 votes

This is a simple mistake, just remove the extra brackets from around sumfunc2 invocation. This should work.

node {
   stage 'test'
   def whatThe = someFunc('textToFunc')
   def whatThe2 = someFunc2('textToFunc2')
}
def someFunc(String text){
    echo text
    text
}
def someFunc2(String text2){
    echo text2
    text2
}
answered Aug 17, 2018 by Sophie may
• 10,620 points

Related Questions In Jenkins

+1 vote
1 answer

java.lang.NoSuchMethodError: No such DSL method 'pipeline' found among steps

Hi@akhtar, I think you did not install your ...READ MORE

answered Jul 7, 2020 in Jenkins by MD
• 95,460 points
45,369 views
+1 vote
3 answers

"No such file pom.xml" error in Jenkins

Can you please che ck the location ...READ MORE

answered May 16, 2019 in Jenkins by Samir
21,750 views
0 votes
1 answer
0 votes
1 answer

java.lang.NoSuchMethodError: No such DSL method 'autoClean' found among steps

Hi@Nagarjun, It seems the plugin you are using ...READ MORE

answered Oct 19, 2020 in Jenkins by MD
• 95,460 points
2,185 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,007 views
+2 votes
1 answer
0 votes
5 answers
0 votes
3 answers

Error: ‘Jenkins: Cannot define variable in pipeline stage’

https://stackoverflow.com/questions/39832862/jenkins-cannot-define-var ...READ MORE

answered Mar 13, 2019 in Jenkins by Charles Wu
5,091 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP