构建步骤“ Windows PowerShell”在詹金斯中将构建标记为失败

时间:2018-06-22 09:11:41

标签: jenkins jenkins-plugins

我正在尝试运行一个简单的powershell脚本,作为后期构建Windows powershell的步骤。     我给的命令是powershell -File test.ps1。     test.ps1文件具有一个简单的写主机,该主机显示:写主机“您好,您好吗”     该构建是一个Maven项目,可以正常运行,而无需包含Windows Powershell发布步骤。但是,在包含powershell脚本的情况下,它失败并引发以下错误-

         [JENKINS] Archiving C:\Jenkins\workspace\WLR3\pom.xml to aBILLity/NxTier/1.0-SNAPSHOT/NxTier-1.0-SNAPSHOT.pom
            [WLR3] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\TEST_R~1\AppData\Local\Temp\jenkins9080398754273983665.ps1'"
            The system cannot find the file specified
            FATAL: command execution failed
            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>(ProcessImpl.java:386)
                at java.lang.ProcessImpl.start(ProcessImpl.java:137)
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
            Caused: java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\Jenkins\workspace\WLR3"): CreateProcess error=2, The system cannot find the file specified
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
                at hudson.Proc$LocalProc.<init>(Proc.java:249)
                at hudson.Proc$LocalProc.<init>(Proc.java:218)
                at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
                at hudson.Launcher$ProcStarter.start(Launcher.java:449)
                at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
                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:744)
                at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:939)
                at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:890)
                at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
                at hudson.model.Run.execute(Run.java:1794)
                at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
                at hudson.model.ResourceController.execute(ResourceController.java:97)
                at hudson.model.Executor.run(Executor.java:429)
            Build step 'Windows PowerShell' marked build as failure
            channel stopped 

任何帮助将不胜感激!     非常感谢!

0 个答案:

没有答案