简体   繁体   English

如何解决问题groovy.lang.MissingMethodException:没有方法的签名:

[英]how to resolve the issue groovy.lang.MissingMethodException: No signature of method:

I am getting an error in jenkins pipeline script. 我在jenkins管道脚本中收到错误。 The error says that groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor() is applicable for argument types: () values: [] 错误说groovy.lang.MissingMethodException:没有方法签名:org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor()适用于参数类型:()值:[]

I am trying to integrate jenkins and grafana 我想整合jenkins和grafana

   stage('Grafana Results') {

 // grafana url for aggregate dashboard - replace time stamp with %s
   def perfResult = "<grafana url>?orgId=39&from=%s&to=%s"
 // get build start and end time
  def start = currentBuild.getStartTimeInMillis();
  def end = start + currentBuild.getExecutor().getElapsedTime();
// replace time
  perfResult = String.format(perfResult, start, end);


 //build the string to be added as description.
  def link = "<a href='%s'>%s</a><br/>";
 def sb = new StringBuilder();
 sb.append(String.format(link, perfResult, "Grafana Performance Result"));

 // set build description
   currentBuild.setDescription(sb.toString());
    }

first - you have to read error. 首先 - 你必须阅读错误。 there is an answer in it: 有一个答案:

No signature of method: 没有方法签名:

org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor()

is applicable for argument types: () values: [] 适用于参数类型:()值:[]

search the documentation for the class org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper : 搜索类org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper的文档:

https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html

and in this class there is no method getExecutor() . 在这个类中没有getExecutor()方法。

however there is a getRawBuild() method that returns https://javadoc.jenkins.io/hudson/model/Run.html 但是有一个getRawBuild()方法返回https://javadoc.jenkins.io/hudson/model/Run.html

so, probably this will work for you: 所以,这可能适合你:

currentBuild.getRawBuild().getExecutor().getElapsedTime()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Groovy:groovy.lang.MissingMethodException:方法未签名 - Groovy : groovy.lang.MissingMethodException: No signature of method jenkinspipeline groovy.lang.MissingMethodException:没有方法签名 - jenkinspipeline groovy.lang.MissingMethodException: No signature of method 捕获:groovy.lang.MissingMethodException:没有方法的签名 - Caught: groovy.lang.MissingMethodException: No signature of method groovy.lang.MissingMethodException:没有方法解析的签名 - groovy.lang.MissingMethodException: No signature of method resolution groovy.lang.MissingMethodException:没有方法的签名: - groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException:没有方法签名 - groovy.lang.MissingMethodException: No signature of method 错误:groovy.lang.MissingMethodException:没有方法签名 - ERROR:groovy.lang.MissingMethodException: No signature of method 如何修复groovy.lang.MissingMethodException:没有方法的签名 - how to fix groovy.lang.MissingMethodException: No signature of method 如何修复 groovy.lang.MissingMethodException: No signature of method: - how to fix groovy.lang.MissingMethodException: No signature of method: 如何解决groovy.lang.MissingMethodException? - How to resolve groovy.lang.MissingMethodException?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM