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,280 points
1,697 views
It's a syntax error! Check your  someFunc syntax

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,050 points

Related Questions In Jenkins

0 votes
2 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
91 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,500 points
58 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,500 points
171 views
0 votes
2 answers
+13 votes
2 answers
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
518 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.