每次我尝试运行一个构建时,我都会看到这样的一行:
/Users/Shared/Jenkins/Home/jobs/dghhtreew/workspace/build.xml:28:
The following error occurred while executing this line:
/Users/Shared/Jenkins/Home/jobs/dghhtreew/workspace/build.xml:39: Execute failed: java.io.IOException: Cannot run program "pdepend": error=2, No such file or directory下面是来自我的build.xml的相关部分,它是由自动生成的:
...
<target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs"/>
<antcall target="phpdoc"/>
<antcall target="phploc"/>
</parallel>
</target>
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
<exec executable="pdepend">
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml
--jdepend-chart=${basedir}/build/pdepend/dependencies.svg
--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg
${source}" />
</exec>
</target>
... 显然,Jenkins用户找不到这些命令什么的。当我通过终端登录到Jenkins时:
sudo -s -H -u jenkins 并尝试pdepend --它的工作方式与预期的一样。但出于某种原因,在Jenkins服务器上执行时,它将无法工作。我尝试在可执行行中设置绝对路径,但结果是相同的。我没有搞砸安装什么的,我有最新版本(1.488)的詹金斯通过mac安装程序。
为什么詹金斯什么都不能做?
发布于 2012-11-03 14:21:36
这是执行任务的执行路径问题。尝试指定path命令的整个路径。
<exec executable="/complete/path/to/command/pdepend">
..更新
如果仍然不能工作,请检查pdepend命令的权限,以确保它是由jenkins用户执行的。
在直接运行when命令时,也值得检查返回代码:
sudo -u jenkins /complete/path/to/command/pdepend || echo non-zero return code发布于 2014-06-07 18:29:02
也许您还没有安装命令,所以对我来说,最简单的方法是通过composer:
composer global require 'pdepend/pdepend=*'如果您没有作曲家,请安装它:
curl -sS https://getcomposer.org/installer | php
php composer.phar global require 'pdepend/pdepend=*'让我们来添加路径变量,您不需要添加路径
https://stackoverflow.com/questions/13204233
复制相似问题