0

我尝试在我的 jenkins 服务器中执行 behat(类似于this)。

我的构建xml:

<target name="behat" description="Execute the behat tests">
    <exec command="${basedir}/bin/behat --profile jenkins -c ${basedir}/config/behat.yml"  />       
</target>

(是的,我的 bin 位于 ./bin 而不是 ./vendor/bin)

但是我收到此错误:

var/lib/jenkins/jobs/defTest/workspace/build.xml:116: Execute failed: java.io.IOException: Cannot run program "/var/lib/jenkins/jobs/defTest/workspace/bin/behat": error=13, Keine Berechtigung
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at java.lang.Runtime.exec(Runtime.java:617)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

原因:java.io.IOException: error=13,Keine Berechtigung at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:135) at java.lang.ProcessImpl.start( ProcessImpl.java:130) 在 java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ... 23 更多

(“Keine Berechtigung”是德语“Permission denied”的意思)我试图将 behat 文件 chmod 到 777,但是当我从一个 mercurial 存储库中提取时,我的更改似乎总是被撤消。

您对如何解决我的问题有任何想法吗?

4

1 回答 1

2

添加预构建 shell 任务:

chmod 777 /PATH_TO_BEHAT/bin/behat

于 2013-10-08T18:24:51.070 回答