0

I am using job dsl to create jenkins jobs. I want to send emails out on job failures. I have already installed and configured 'ext-email' plugin. I have also added following section to my job DSL script

extendedEmail('me@halfempty.org', 'Oops', 'Something broken')

However I get following error

groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.Job.extendedEmail() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values: [me@halfempty.org, Oops, Something broken] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) at script1410384571000472680582$_run_closure1.doCall(script1410384571000472680582.groovy:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)

Any idea how can I get around it

Pushkar
  • 541
  • 4
  • 18

2 Answers2

1

Figured out the answer

extendedEmail('me@halfempty.org', 'Oops', 'Something broken') has to be wrapped inside publisher i.e. it should look like

publisher { extendedEmail('me@halfempty.org', 'Oops', 'Something broken') }

Pushkar
  • 541
  • 4
  • 18
1

You can always refer to this API there if you search a method you get the context in which it should present.. though you already got your answer but just to write so that it can help someone

Chetan Sharma
  • 173
  • 1
  • 3
  • 16