2014-09-26 15 views
8

sto cercando di configurare lavoro Jenkins con script Groovy, io donot so quello che sto facendo male con la configurazione che non ho potuto eseguire anche un semplice comando di groove comeHudson * .groovy non trovato in Jenkins

println System.getenv("PATH") 

mostra la seguente analisi dello stack quando i Jenkins cerca di costruire poi seguente errore viene generato

[workspace] $ groovy "C:\Program Files (x86)\Jenkins\jobs\{Project_Name}\workspace\hudson2392295018240496017.groovy" 
The system cannot find the file specified 
FATAL: command execution failed 
java.io.IOException: Cannot run program "groovy" (in directory "C:\Program Files (x86)\Jenkins\jobs\{Project_Name}\workspace"): CreateProcess error=2, The system cannot find the file specified 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.<init>(Proc.java:244) 
    at hudson.Proc$LocalProc.<init>(Proc.java:216) 
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:780) 
    at hudson.Launcher$ProcStarter.start(Launcher.java:360) 
    at hudson.Launcher$ProcStarter.join(Launcher.java:367) 
    at hudson.plugins.groovy.Groovy.perform(Groovy.java:110) 
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772) 
    at hudson.model.Build$BuildExecution.build(Build.java:199) 
    at hudson.model.Build$BuildExecution.doRun(Build.java:160) 
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535) 
    at hudson.model.Run.execute(Run.java:1732) 
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
    at hudson.model.ResourceController.execute(ResourceController.java:88) 
    at hudson.model.Executor.run(Executor.java:234) 
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified 
    at java.lang.ProcessImpl.create(Native Method) 
    at java.lang.ProcessImpl.<init>(Unknown Source) 
    at java.lang.ProcessImpl.start(Unknown Source) 
    ... 16 more 
Build step 'Execute Groovy script' marked build as failure 
Finished: FAILURE 

sto utilizzando di default groovy version in configurazione Jenkins e ho installato i plugin Jenkins per Groovy.

Sono nuovo per entrambi jenkins e groovy. Grazie in anticipo.

risposta

11

È necessario disporre di una installazione di Groovy cui il vostro Jenkins può vedere - che è l'opzione predefinita

In alternativa, è possibile aggiungere uno nella configurazione globale

enter image description here

che possono poi essere utilizzato nel passaggio di generazione

enter image description here

Started by user anonymous 
Building in workspace /Users/xxxxxx/.jenkins/jobs/gr/workspace 
[workspace] $ groovy /Users/xxxxx/.jenkins/jobs/gr/workspace/hudson5419917819864291744.groovy 
build 
/Users/xxxxxx/perl5/perlbrew/bin:/Users/xxxxx/perl5/perlbrew/perls/perl-5.16.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 
Finished: SUCCESS 
+0

Ho seguito la procedura di cui sopra ma non sono in grado di costruire il mio lavoro. Ci vuole troppo tempo per essere costruito. – RCBian

+0

Fyi, i binari groovy sono stati spostati da codehouse a bintray, ad esempio https://bintray.com/artifact/download/groovy/maven/groovy-binary-2.2.1.zip. – Lidia

Problemi correlati