Re: Execute groovy script in Masters throwing error

2014-08-14 Thread suchit biswal
yes I imported the packages, and copyied the hudsion-core.jar  to the lip 
folder in masters resolved the issue

On Thursday, August 14, 2014 12:04:31 PM UTC-7, suchit biswal 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 jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Execute groovy script in Masters throwing error

2014-08-14 Thread suchit biswal
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 jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.