I think you need to import the classes containing those items that don't
resolve. I don't have the doc in front of me so I can't check what class to
import
On Aug 14, 2014 3:04 PM, "suchit biswal" <[email protected]> wrote:

> Hi Folks,
>
> I am trying to execute the following groovy script as part of my build
> step, which will get the latest build number for a job and will insert as a
> env variable of the current job
>
> Please help me resolving this.
>
>
> *def item = hudson.model.Hudson.instance.getItem("SDPAutomationExecution")*
>
> *def build = item.getLastBuild()*
>
> *println(build.getNumber())*
>
>
> *def pa = new ParametersAction([*
> *  new StringParameterValue("miniVersion", build.getNumber())*
> *])*
>
> *// add variable to current job*
> *Thread.currentThread().executable.addAction(pa)*
>
>
> here is the exception
>
> *Execution of script [getLatestBuildNumber.groovy] failed - 
> org.jenkinsci.plugins.scriptler.util.GroovyScript$ScriptlerExecutionException:
>  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Script1.groovy: 8: unable to resolve class ParametersAction
>  @ line 8, column 10.
>    def pa = new ParametersAction([
>             ^
>
> Script1.groovy: 9: unable to resolve class StringParameterValue
>  @ line 9, column 3.
>      new StringParameterValue("miniVersion", build.getNumber())
>      ^
>
> 2 errors
> hudson.remoting.ProxyException: 
> org.jenkinsci.plugins.scriptler.util.GroovyScript$ScriptlerExecutionException:
>  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Script1.groovy: 8: unable to resolve class ParametersAction
>  @ line 8, column 10.
>    def pa = new ParametersAction([
>             ^
>
> Script1.groovy: 9: unable to resolve class StringParameterValue
>  @ line 9, column 3.
>      new StringParameterValue("miniVersion", build.getNumber())
>      ^
>
> 2 errors
>
>       at 
> org.jenkinsci.plugins.scriptler.util.GroovyScript.call(GroovyScript.java:131)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:118)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:48)
>       at hudson.remoting.Request$2.run(Request.java:328)
>       at 
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
>       at java.util.concurrent.FutureTask.run(Unknown Source)
>       at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>       at hudson.remoting.Engine$1$1.run(Engine.java:63)
>       at java.lang.Thread.run(Unknown Source)
> Caused by: hudson.remoting.ProxyException: 
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> Script1.groovy: 8: unable to resolve class ParametersAction *
>
>
>  --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to