1
votes

I want deploy in Glassfish a WAR using these batch commands from Jenkins. :

This is how I deploy a WAR with Batch command : H:\workspace\xxxx>"C:\glassfish3\glassfish\bin\asadmin.bat" "undeploy" Enter the value for the name operand> xxxx

H:\workspace\xxxx>"C:\glassfish3\glassfish\bin\asadmin.bat" "deploy"
Enter the value for the path operand> H:\xxxx-sources\xxxx.war
Application deployed with name xxxx.
Command deploy executed successfully.

In Jenkins , I add a batch command in my build with that :

cd "C:\glassfish3\glassfish\bin\"
asadmin.bat "undeploy"
XXXX
asadmin.bat "deploy"
H:\XXXX sources\XXXX.war

I have this error :

Démarré par l'utilisateur anonymous Building on master in workspace C:\Documents and Settings\XXXX.XXXX.jenkins\jobs\deployerXXXXCore\workspace [workspace] $ sh -xe C:\DOCUME~1\XXXX~1.XXXX\LOCALS~1\Temp\hudson2065869118895930371.sh The system cannot find the file specified FATAL: L'exécution de la commande a échoué. java.io.IOException: Cannot run program "sh" (in directory "C:\Documents and Settings\XXXX.XXXX.jenkins\jobs\deployerXXXX\workspace"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at hudson.Proc$LocalProc.(Proc.java:244) at hudson.Proc$LocalProc.(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:802) at hudson.Launcher$ProcStarter.start(Launcher.java:380) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770) 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:533) at hudson.model.Run.execute(Run.java:1759) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) 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.(ProcessImpl.java:81) at java.lang.ProcessImpl.start(ProcessImpl.java:30) at java.lang.ProcessBuilder.start(ProcessBuilder.java:453) ... 15 more Build step 'Exécuter un script shell' marked build as failure Finished: FAILURE

1

1 Answers

3
votes

It seems that you are trying to execute your scripts in Jenkins using shell script execution,which works only on unix-like systems. Try doing the same with Windows batch execution in the Jenkins job.

You should select 'Execute Windows batch command' according to Jenkins guide.