警告:未启用 PHPLoc 扩充或 phploc.xml 在 phpDox 中未找到

Warning: PHPLoc enrichment not enabled or phploc.xml not found in phpDox

我使用 Jenkins 和 Ant 在项目构建中为我的 PHP 项目生成 API 文档:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="full-build">
    <property name="pdepend" value="/usr/share/.composer/vendor/bin/pdepend" />
    ...
    <target name="full-build" depends="prepare,static-analysis,phpdox" />
    <target name="prepare" unless="prepare.done" depends="clean">
        <mkdir dir="${basedir}/build/api" />
        ...
    </target>
    <target name="clean" unless="clean.done">
        <delete dir="${basedir}/build/api" />
        ...
    </target>
    <target name="static-analysis">
        <parallel threadCount="2">
            <sequential>
                <antcall target="pdepend" />
                <antcall target="phpmd" />
            </sequential>
            <antcall target="lint" />
            <antcall target="phpcpd" />
            <antcall target="phpcs" />
            <antcall target="phploc" />
        </parallel>
    </target>
    <target name="pdepend" unless="pdepend.done" depends="prepare">
        ...
    </target>
    <target name="phpmd" unless="phpmd.done">
        ...
    </target>
    <target name="lint" unless="lint.done">
        ...
    </target>
    <target name="phpcpd" unless="phpcpd.done">
        ...
    </target>
    <target name="phpcs" unless="phpcs.done">
        ...
    </target>
    <target name="phpdox" depends="phploc,phpcs,phpmd" unless="phpdox.done">
        <exec executable="${phpdox}" dir="${basedir}/build" taskname="phpdox">
            <arg value="--file" />
            <arg value="${basedir}/build/phpdox.xml" />
        </exec>
        <property name="phpdox.done" value="true" />
    </target>
    <target name="phploc" unless="phploc.done">
        ...
    </target>
</project>

构建完成后,我打开 API 文档的 index.xhtml,显示警告:

Warning: PHPLoc enrichment not enabled or phploc.xml not found.

为什么会显示这个警告,如何解决它引起的问题?

phpDox 需要生成一个 phploc.xml 文件。您的目标 phploc 是否生成这样的文件(参数:--log-xml <filename>)?

示例目标 phploc:

<target name="phploc" unless="phploc.done">
    <exec executable="${phploc}" taskname="phploc">
        <arg value="--count-tests" />
        <arg value="--log-csv" />
        <arg path="${basedir}/build/logs/phploc.csv" />
        <arg value="--log-xml" />
        <arg path="${basedir}/build/logs/phploc.xml" />
        <arg path="....." />
    </exec>
    <property name="phploc.done" value="true"/>
</target>

如果未找到或启动 PHPLOC enricher,则应从 phpDox Ant 构建脚本反馈中省略以下行:

[phpdox] [06.07.2016 - 16:37:58] Registered enricher 'phploc'