java.lang.NoSuchMethodError: No such DSL method 'git' found

4,118 views
Skip to first unread message

John McC

unread,
Jun 8, 2016, 5:52:07 PM6/8/16
to Jenkins Users
I just downloaded and installed the Mac OSX package (Jenkins 2.8) and created a test pipeline, using the sample script (shown below).  The plugins seem to be in place (I opted to let the install choose the common ones for me). 

node {
   // Mark the code checkout 'stage'....
   stage 'Checkout'

   // Get some code from a GitHub repository

   // Get the maven tool.
   // ** NOTE: This 'M3' maven tool must be configured
   // **       in the global configuration.           
   def mvnHome = tool 'M3'

   // Mark the code build 'stage'....
   stage 'Build'
   // Run the maven build
   sh "${mvnHome}/bin/mvn clean install"
}

[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'git' found among [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, error, fileExists, input, isUnix, load, mail, node, parallel, properties, pwd, readFile, readTrusted, retry, sh, sleep, stage, stash, step, svn, timeout, timestamps, tool, unarchive, unstash, waitUntil, withCredentials, withEnv, wrap, writeFile, ws]
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:108)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:113)
	at groovy.lang.GroovyObject$invokeMethod.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)
	at WorkflowScript.run(WorkflowScript:6)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:55)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:276)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:78)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:185)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:183)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Finished: FAILURE

Any suggestions?

Michael Neale

unread,
Jun 8, 2016, 10:19:51 PM6/8/16
to Jenkins Users
normally that means that the git plugin is not installed, but I think it is included with the "recommended" - can you double check the installed plugin list? 

John McC

unread,
Jun 9, 2016, 1:13:05 AM6/9/16
to Jenkins Users
I have:

Git client plugin 1.19.6
Git plugin 2.4.4
Git server plugin 1.6
Github API plugin 1.75
[a few other github plugins]

Daniel Beck

unread,
Jun 9, 2016, 5:19:55 AM6/9/16
to jenkins...@googlegroups.com
Restart Jenkins. There's a known issue with plugin load order.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5f05e1e8-a58d-4ec0-b3c3-b7995b550c4e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

John McC

unread,
Jun 9, 2016, 2:25:58 PM6/9/16
to Jenkins Users, m...@beckweb.net
That worked -- thank you!

Jirong Hu

unread,
Aug 8, 2016, 2:56:29 PM8/8/16
to Jenkins Users, m...@beckweb.net
Hi Daniel

We are also getting this error and a restart doesn't fix it. Please see more details in this post: http://stackoverflow.com/questions/38831216/jenkins-pipeline-sample-step-missing-git-git

Below are Git related plugin versions on our servers. Any suggestion? Thanks.

                                                   DEV         PRD
git 2.4.4 2.4.4 git
git-client 1.19.6 1.19.6 git-client
git-server 1.6 1.7 git-server
github 1.14.0 1.14.0 github
github-api 1.75 1.75 github-api
github-branch-source 1.7 1.8.1 github-branch-source
github-organization-folder 1.3 1.4 github-organization-folder

Mark Waite

unread,
Aug 8, 2016, 3:18:48 PM8/8/16
to Jenkins Users, m...@beckweb.net
Does the "git"section appear if you choose "checkout" from the snippet generator instead of choosing "git"?

Is there a reason you haven't updated to the most recent version of the git plugin?  Git plugin 2.5.1 added much better support for setting git options from pipeline jobs.  Git plugin 2.5.3 (the most recent release) is the best git plugin for pipeline use as far as I can tell.

Also, I've preferred to use the "checkout" snippet generator.  It lets me choose the detailed git options that I want (so long as I use git plugin 2.5.3).

Mark Waite

Jirong Hu

unread,
Aug 8, 2016, 7:47:40 PM8/8/16
to Jenkins Users, m...@beckweb.net
Hi Mark

I found the git section in the "check out scm", and once I upgraded the pipeline plugins in DEV to match the versions in PRD, the git option disappeared too, therefore matches to PRD. Thanks for your suggestion about git, I will look into that.

Jirong
Reply all
Reply to author
Forward
0 new messages