简体   繁体   English

Jenkins:Groovy方法的无签名:静态hudson.model.Job.getBuildDir()

[英]Jenkins: Groovy No signature of method: static hudson.model.Job.getBuildDir()

I am using Jenkins 1.6.20 testing the Workflow Plugin which uses Groovy for creating the job as you would know. 我正在使用Jenkins 1.6.20测试工作流程插件,该插件使用Groovy来创建工作,正如您所知。

I am trying to get information about the current job, for example the working directory of the job. 我正在尝试获取有关当前作业的信息,例如该作业的工作目录。

This is my code: 这是我的代码:

import hudson.EnvVars
import hudson.model.*

def build_number = Job.getBuildDir()

echo "$build_number"

It gives me the error: 它给了我错误:

groovy.lang.MissingMethodException: No signature of method: static hudson.model.Job.getBuildDir() is applicable for argument types: () values: []
Possible solutions: getBuildDir(), getBuilds(), getBuild(java.lang.String), getBuilds(hudson.model.Fingerprint$RangeSet), getRootDir()
    at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1367)
    at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1353)
    at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:50)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
    at WorkflowScript.run(WorkflowScript:4)
    at ___cps.transform___(Native Method)
    at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
    at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:74)
    at sun.reflect.GeneratedMethodAccessor1418.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
    at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)

Using this documentation: 使用本文档:

http://javadoc.jenkins-ci.org/hudson/model/Job.html http://javadoc.jenkins-ci.org/hudson/model/Job.html

I can read that the method getBuildDir is actually there and also the error suggest me to use getBuildDir making no sense for me. 我可以看到方法getBuildDir实际上在那里,并且错误提示我使用getBuildDir对我来说毫无意义。

If it is useful for someone I could get the workspace dir by: 如果对某人有用,我可以通过以下方式获取工作区目录:

node  {
  def pwdv = pwd()
  echo "path ${pwdv}"
}

暂无
暂无

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

相关问题 Jenkins groovy MissingMethodException 没有方法签名 - Jenkins groovy MissingMethodException No signature of method 以编程方式从jenkins插件触发jenkins hudson.model.Job - Trigger jenkins hudson.model.Job programmatically from jenkins plugin 哈德森* .groovy在詹金斯找不到 - hudson*.groovy not found in jenkins 重命名詹金斯/哈德森的工作 - Renaming job in jenkins/hudson hudson.remoting.ProxyException:groovy.lang.MissingMethodException:方法没有签名: - hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: 获取致命错误:没有方法签名:hudson.model.FreeStyleBuild.call()错误 - Getting FATAL: No signature of method: hudson.model.FreeStyleBuild.call() error groovy.lang.MissingMethodException:方法的无签名:在詹金斯构建流程的groovy中 - groovy.lang.MissingMethodException: No signature of method: in groovy on jenkins buildflow 如何使用Hudson类和Groovy从Jenkins Job获得最后一次成功构建 - How to get last successful build from jenkins job using hudson classes and groovy 如何修复“hudson.remoting.ProxyException:groovy.lang.MissingMethodException:没有方法签名:testFunc.call()” - How to fix 'hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: testFunc.call() ' Jenkins groovy.lang.MissingMethodException:没有方法签名:catchError() - Jenkins groovy.lang.MissingMethodException: No signature of method: catchError()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM