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,270 points
4,108 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
• 9,850 points

Related Questions In Jenkins

0 votes
3 answers

"No such file pom.xml" error in Jenkins

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

answered May 15 in Jenkins by Samir
814 views
0 votes
1 answer

Error while communicating with remote Oracle DB through Jenkins-CI

I was also facing the same problem. ...READ MORE

answered Apr 25, 2018 in Jenkins by shubham
• 6,890 points
77 views
0 votes
1 answer

Error while talking to remote Oracle DB using Jenkins-CI

I installed Oracle XE to talk to ...READ MORE

answered May 1, 2018 in Jenkins by shubham
• 6,890 points
281 views
0 votes
2 answers
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
177 views
0 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 in Jenkins by Charles Wu
1,111 views