【问题标题】:Jenkins API documentation with phpdox带有 phpdox 的 Jenkins API 文档
【发布时间】:2014-12-26 12:37:42
【问题描述】:

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

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

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

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

将我踢到 api 文档的 url 如下:

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

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

docs/xml/

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

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

【问题讨论】:

    标签: jenkins


    【解决方案1】:

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

    包含的文档将帮助您了解您的配置有什么问题

    现在的配置方式,文档是在${basedir}/build/api/docs/api目录内生成的,因为build-&gt;output参数附加到了generator-&gt;output url

    所以为了让 jenkins 找到文档并将其复制到 htmlreports 文件夹中,您需要在项目配置中将上述目录设置为“要归档的 HTML 目录”->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

    【讨论】:

      猜你喜欢
      • 2016-03-22
      • 2012-04-20
      • 1970-01-01
      • 2016-03-05
      • 2021-07-22
      • 1970-01-01
      • 1970-01-01
      • 2018-10-09
      • 1970-01-01
      相关资源
      最近更新 更多