使用phpdox的Jenkins API文档

时间:2014-12-26 12:37:43

标签: jenkins

API MyProject链接(由HTML Publisher Jenkins插件生成)提供404。

访问/ job / MyProject /API_MyProject/index.html时遇到问题。原因:未找到

我检查了配置部分的输入,在作业项目中,在发布HTML报告配置中,我看到了以下内容:

要归档的HTML目录:build / api 索引页面[s]:index.html 报告标题:API MyProject

将我踢到api文档的网址如下:

http://jenkins.dev:8080/job/MyProject/API_MyProject/

然后,我检查了build / api文件夹中是否生成了文档,我看到了两个文件夹:

docs / xml /

没有index.html,但是我是否手动生成了一个虚拟index.html文件我仍然得到相同的错误...另一个奇怪的行为是当我编辑报告标题时,它将链接更改为仍未找到api docs ..

phpdox.xml文件:

<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">

    <project name="MyProject" source="${basedir}/protected/models" workdir="${basedir}/build/api/xml">

        <collector publiconly="false">
            <include mask="*.php" />
        </collector>

        <generator output="${basedir}/build/api/docs">
            <build engine="html" enabled="true" output="api">
                <file extension="html" />
            </build>
        </generator>
    </project>

</phpdox>

Jenkins最终控制台输出:

    phpdox:
         [exec] phpDox 0.7.0 - Copyright (C) 2010 - 2014 by Arne Blankerts
         [exec] 
         [exec] [26.12.2014 - 05:57:27] Using config file './phpdox.xml'
         [exec] [26.12.2014 - 05:57:27] Registered collector backend 'parser'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'build'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'git'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'checkstyle'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'phpcs'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'pmd'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'phpunit'
         [exec] [26.12.2014 - 05:57:27] Registered enricher 'phploc'
         [exec] [26.12.2014 - 05:57:27] Registered output engine 'xml'
         [exec] [26.12.2014 - 05:57:27] Registered output engine 'html'
         [exec] [26.12.2014 - 05:57:27] Starting to process project 'MyProject'
         [exec] [26.12.2014 - 05:57:27] Starting collector
         [exec] [26.12.2014 - 05:57:27] Scanning directory '/var/lib/jenkins/jobs/MyProject/workspace/protected/models' for files to process
         [exec] 
         [exec] ................                                    [16]
         [exec] 
         [exec] [26.12.2014 - 05:57:34] Saving results to directory '/var/lib/jenkins/jobs/MyProject/workspace/build/api/xml'
         [exec] [26.12.2014 - 05:57:39] Resolving inheritance
         [exec] 
         [exec] ................                                    [16]
         [exec] 
         [exec] [26.12.2014 - 05:57:39] The following unit(s) had missing dependencies during inheritance resolution:
         [exec] [26.12.2014 - 05:57:39]  - Category (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39]  - LoginForm (missing CFormModel)
         [exec] [26.12.2014 - 05:57:39]  - Mimetype (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39]  - ContactForm (missing CFormModel)
         [exec] [26.12.2014 - 05:57:39]  - File (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39]  - UserAccountReference (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39]  - Currency (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39]  - Account (missing CActiveRecord)
         [exec] [26.12.2014 - 05:57:39] Collector process completed
         [exec] 
         [exec] [26.12.2014 - 05:57:39] Starting generator
         [exec] [26.12.2014 - 05:57:39] Loading enrichers
         [exec] [26.12.2014 - 05:57:39] Starting event loop.
         [exec] 
         [exec] ..................................................  [50]
         [exec] ..................................................  [100]
         [exec] ..................................................  [150]
         [exec] ..................................................  [200]
         [exec] ..................................................  [250]
         [exec] ............                                        [262]
         [exec] 
         [exec] [26.12.2014 - 05:57:41] Generator process completed
         [exec] [26.12.2014 - 05:57:41] Processing project 'MyProject' completed.
         [exec] 
         [exec] 
         [exec] Time: 13 seconds, Memory: 12.75Mb
         [exec] 

build: 

BUILD SUCCESSFUL
Total time: 1 minute 57 seconds
[CHECKSTYLE] Collecting checkstyle analysis files...
[CHECKSTYLE] Finding all files that match the pattern build/logs/checkstyle.xml
[CHECKSTYLE] Parsing 1 file in /var/lib/jenkins/jobs/MyProject/workspace
[CHECKSTYLE] Successfully parsed file /var/lib/jenkins/jobs/MyProject/workspace/build/logs/checkstyle.xml with 67 unique warnings and 0 duplicates.
[PMD] Collecting PMD analysis files...
[PMD] Finding all files that match the pattern build/logs/pmd.xml
[PMD] Parsing 1 file in /var/lib/jenkins/jobs/MyProject/workspace
[PMD] Successfully parsed file /var/lib/jenkins/jobs/MyProject/workspace/build/logs/pmd.xml with 61 unique warnings and 0 duplicates.
[DRY] Collecting duplicate code analysis files...
[DRY] Finding all files that match the pattern build/logs/pmd-cpd.xml
[DRY] Parsing 1 file in /var/lib/jenkins/jobs/MyProject/workspace
[DRY] Successfully parsed file /var/lib/jenkins/jobs/MyProject/workspace/build/logs/pmd-cpd.xml with 0 unique warnings and 0 duplicates.
Recording plot data
Publishing Clover coverage report...
Clover xml file does not exist in: /var/lib/jenkins/jobs/MyProject/workspace called: build/logs/clover.xml and will not be copied to: /var/lib/jenkins/jobs/MyProject/builds/2014-12-26_11-55-21/cloverphp/clover.xml
Could not find 'build/coverage/build/logs/clover.xml'.  Did you generate the XML report for Clover?
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /var/lib/jenkins/jobs/MyProject/workspace/build/api to /var/lib/jenkins/jobs/MyProject/builds/2014-12-26_11-55-21/htmlreports/API_Unnamed
[JDepend] JDepend plugin is ready
[JDepend] Found 16 classes in 2 packages
Finished: SUCCESS

1 个答案:

答案 0 :(得分:2)

刚刚遇到类似的问题,我在运行phpdox --skel时检查了组件生成的骨架phpdox.xml作为指南。

附带的文档将帮助您了解配置的错误

现在配置方式,文档在目录${basedir}/build/api/docs/api内生成,因为build->output参数附加到generator->output网址

因此,为了让jenkins找到文档并将其复制到htmlreports文件夹,您需要将上述目录设置为&#34; HTML目录以进行存档&#34;在您的项目配置中 - &gt; html报告

我的配置如下:

<generator output="${basedir}/build"> <build engine="html" enabled="true" output="api">

并在项目配置中"HTML directory to archive":"app/build/api"

如果您的配置不是问题,请检查输出目录中是否存在index.html文件,因为我认为默认情况下phpdox会生成index.xhtml。如果是这种情况,您也可以在配置中更改它

<build engine="html" enabled="true" output="api"> <file extension="xhtml" /> </build>

xhtml更改为html