我正在使用build.xml将一个Ant转换为一个项目。其中一个目标是使用phploc,我使用<phploc/>任务将其转换为目标。我收到了错误消息:
Execution of target "phploc" failed for the following reason: \
/Users/david/workspace/phoenix/build-test/build.xml:44:17: \
/Users/david/workspace/phoenix/build-test/build.xml:44:17: \
PHPLocTask depends on PHPLoc being installed and on include_path.我下载了作为一个PHPLoc文件分发的*.phar,并遵循了README.md中的说明。
$ phploc -help
phploc 2.0.6 by Sebastian Bergmann.
Usage:
phploc [--names="..."] [--names-exclude="..."] [--count-tests] [--git-repository="..."] [--exclude="..."] [--log-csv="..."] [--log-xml="..."] [--progress] [values1] ... [valuesN]
...我仍然收到同样的错误信息。我找到了我的include_path
$ php -i 2> /dev/null | grep "^include_path"
include_path => .:/usr/local/php/includes:/usr/local/pear/share/pear:/usr/lib/php/pear => .:/usr/local/php/includes:/usr/local/pear/share/pear:/usr/lib/php/pear并将phploc复制到/usr/local/php/includes,但无论它名为PHPLoc还是phploc,我仍然会收到相同的错误消息。
我在/usr/lib/php/pear/phing/Phing/tasks/ext/phploc/PHPLoc.php中找到phploc任务
public function main()
{
/**
* Find PHPLoc
*/
if (!class_exists('\SebastianBergmann\PHPLOC\Analyser')) {
if (!@include_once('SebastianBergmann/PHPLOC/autoload.php')) {
if (!@include_once('PHPLOC/Analyser.php')) {
throw new BuildException(
'PHPLocTask depends on PHPLoc being installed and on include_path.',
$this->getLocation()
);
} else {
$this->oldVersion = true;
}
}
}第一个class_exists语句没有返回一个真值,include_once也没有得到包含的文件。我想知道这是否是因为phploc是一个PHAR包,而不是单个文件。
我总是可以执行<exec/>或<apply/>任务,但我认为最好使用已经定义的任务。
我需要做什么来安装phploc,以便<phploc> Phing任务能够找到它?
发布于 2014-07-10 20:07:48
这些信息没有出现在phploc页面上,但是在浏览了所有的文件和Googling之后,我发现我可以这样做:
$ sudo pear channel-discover pear.phpunit.de
$ sudo pear channel-discover pear.symfony.com
$ sudo pear channel-discover pear.netpirates.net
$ sudo pear install phpunit/phploc这通过梨安装phploc,Phing可以使用它。Phar包似乎不适用于Phing。
发布于 2015-01-09 10:35:26
梨道现在关闭了。您应该在您的build.xml中添加这样的内容:
<php expression="include('/var/lib/jenkins/.composer/vendor/autoload.php')"/>并以Jenkins用户的身份全局安装composer的所有dependiens
composer global require 'phploc/phploc=*'或将所有工具包括在项目中,并设置正确的自动加载文件。
https://stackoverflow.com/questions/24642125
复制相似问题