2013-05-01 54 views
1

所以使用jenkins-php.org我試圖設置一個項目。不幸的是我得到錯誤。首先,我在哪裏放置它要求的xml配置文件(phpmd和phpcd)?是否有一些我可以用作起點的標準配置?jenkins設置一個php項目 - 日誌中的錯誤

但最重要的是在日誌結尾處發生了什麼?我如何解決這個錯誤?

Started by user anonymous 
Building in workspace /var/lib/jenkins/jobs/MyDemo/workspace 
Checkout:workspace//var/lib/jenkins/jobs/MyDemo/workspace - [email protected] 
Using strategy: Default 
Last Built Revision: Revision 3653bdb (origin/master, origin/HEAD) 
Fetching changes from 1 remote Git repository 
Fetching upstream changes from origin 
Seen branch in repository origin/HEAD 
Seen branch in repository origin/master 
Commencing build of Revision 9e40e86 (origin/master, origin/HEAD) 
Checking out Revision 9e40e86 (origin/master, origin/HEAD) 
Warning : There are multiple branch changesets here 
[workspace] $ ant 
Buildfile: /var/lib/jenkins/jobs/MyDemo/workspace/build.xml 

clean: 
[delete] Deleting directory /var/lib/jenkins/jobs/MyDemo/workspace/build/api 
[delete] Deleting directory /var/lib/jenkins/jobs/MyDemo/workspace/build/code-browser 
[delete] Deleting directory /var/lib/jenkins/jobs/MyDemo/workspace/build/coverage 
[delete] Deleting directory /var/lib/jenkins/jobs/MyDemo/workspace/build/logs 
[delete] Deleting directory /var/lib/jenkins/jobs/MyDemo/workspace/build/pdepend 

prepare: 
[mkdir] Created dir: /var/lib/jenkins/jobs/MyDemo/workspace/build/api 
[mkdir] Created dir: /var/lib/jenkins/jobs/MyDemo/workspace/build/code-browser 
[mkdir] Created dir: /var/lib/jenkins/jobs/MyDemo/workspace/build/coverage 
[mkdir] Created dir: /var/lib/jenkins/jobs/MyDemo/workspace/build/logs 
[mkdir] Created dir: /var/lib/jenkins/jobs/MyDemo/workspace/build/pdepend 

lint: 

phploc: 
[exec] phploc 1.7.4 by Sebastian Bergmann. 
[exec] 
[exec] Lines of Code (LOC): 9 
[exec] Cyclomatic Complexity/Lines of Code: 0.11 
[exec] Comment Lines of Code (CLOC): 0 
[exec] Non-Comment Lines of Code (NCLOC): 9 
[exec] 
[exec] Namespaces: 0 
[exec] Interfaces: 0 
[exec] Traits: 0 
[exec] Classes: 1 
[exec] Abstract: 0 (0.00%) 
[exec] Concrete: 1 (100.00%) 
[exec] Average Class Length (NCLOC): 7 
[exec] Methods: 1 
[exec] Scope: 
[exec] Non-Static: 1 (100.00%) 
[exec] Static: 0 (0.00%) 
[exec] Visibility: 
[exec] Public: 1 (100.00%) 
[exec] Non-Public: 0 (0.00%) 
[exec] Average Method Length (NCLOC): 7 
[exec] Cyclomatic Complexity/Number of Methods: 2.00 
[exec] 
[exec] Anonymous Functions: 0 
[exec] Functions: 0 
[exec] 
[exec] Constants: 0 
[exec] Global constants: 0 
[exec] Class constants: 0 

pdepend: 
[exec] PHP_Depend 1.1.0 by Manuel Pichler 
[exec] 
[exec] Parsing source files: 
[exec] . 1 
[exec] 
[exec] Executing Coupling-Analyzer: 
[exec] 4 
[exec] 
[exec] Executing CyclomaticComplexity-Analyzer: 
[exec] 4 
[exec] 
[exec] Executing Dependency-Analyzer: 
[exec] 3 
[exec] 
[exec] Executing Inheritance-Analyzer: 
[exec] 2 
[exec] 
[exec] Executing NodeCount-Analyzer: 
[exec] 3 
[exec] 
[exec] Executing NodeLoc-Analyzer: 
[exec] 4 
[exec] 
[exec] Generating pdepend log files, this may take a moment. 
[exec] 
[exec] Time: 00:00; Memory: 3.00Mb 

phpmd-ci: 
[exec] Cannot find specified rule-set "/var/lib/jenkins/jobs/MyDemo/workspace/build/phpmd.xml". 
[exec] Result: 1 

phpcs-ci: 
[exec] Result: 2 

phpcpd: 
[exec] phpcpd 1.4.1 by Sebastian Bergmann. 
[exec] 
[exec] 0.00% duplicated lines out of 9 total lines of code. 
[exec] 
[exec] Time: 0 seconds, Memory: 0.75Mb 

phpunit: 
[exec] PHPUnit 3.7.19 by Sebastian Bergmann. 
[exec] 
[exec] Configuration read from /var/lib/jenkins/jobs/MyDemo/workspace/phpunit.xml.dist 
[exec] 
[exec] . 
[exec] 
[exec] Time: 0 seconds, Memory: 3.00Mb 
[exec] 
[exec] OK (1 test, 1 assertion) 
[exec] 
[exec] Generating code coverage report in Clover XML format ... done 
[exec] 
[exec] Generating code coverage report in HTML format ... done 

phpcb: 
[exec] [Warning] Could not read file '/var/lib/jenkins/jobs/MyDemo/workspace/build/logs/pmd.xml'. Make sure it contains valid xml. 

build: 

BUILD SUCCESSFUL 
Total time: 4 seconds 
[CHECKSTYLE] Collecting checkstyle analysis files... 
[CHECKSTYLE] Finding all files that match the pattern build/logs/checkstyle.xml 
[PMD] Collecting PMD analysis files... 
[PMD] Finding all files that match the pattern build/logs/pmd.xml 
[PMD] Parsing 1 files in /var/lib/jenkins/jobs/MyDemo/workspace 
[PMD] Skipping file of module /var/lib/jenkins/jobs/MyDemo/workspace/build/logs/pmd.xml because it's empty. 
[DRY] Collecting duplicate code analysis files... 
[DRY] Finding all files that match the pattern build/logs/pmd-cpd.xml 
[DRY] Parsing 1 files in /var/lib/jenkins/jobs/MyDemo/workspace 
[DRY] Successfully parsed file /var/lib/jenkins/jobs/MyDemo/workspace/build/logs/pmd-cpd.xml of module with 0 warnings. 
Recording plot data 
Publishing Clover coverage report... 
Publishing Clover HTML report... 
Publishing Clover XML report... 
Publishing Clover coverage results... 
[htmlpublisher] Archiving HTML reports... 
[htmlpublisher] Archiving at BUILD level /var/lib/jenkins/jobs/MyDemo/workspace/build/api to /var/lib/jenkins/jobs/MyDemo/builds/2013-04-26_23-54-18/htmlreports/API_Documentation 
ERROR: Directory '/var/lib/jenkins/jobs/MyDemo/workspace/build/api' exists but failed copying to '/var/lib/jenkins/jobs/MyDemo/builds/2013-04-26_23-54-18/htmlreports/API_Documentation'. 
ERROR: This is especially strange since your build otherwise succeeded. 
Build step 'Publish HTML reports' changed build result to FAILURE 
[xUnit] [INFO] - Starting to record. 
[xUnit] [INFO] - Processing PHPUnit-3.x (default) 
[xUnit] [INFO] - [PHPUnit-3.x (default)] - 1 test report file(s) were found with the pattern 'build/logs/junit.xml' relative to '/var/lib/jenkins/jobs/MyDemo/workspace' for the testing framework 'PHPUnit-3.x (default)'. 
[xUnit] [INFO] - Check 'Failed Tests' threshold. 
[xUnit] [INFO] - Check 'Skipped Tests' threshold. 
[xUnit] [INFO] - Setting the build status to FAILURE 
[xUnit] [INFO] - Stopping recording. 
[JDepend] JDepend plugin is ready 
[JDepend] Found 1 classes in 1 packages 
ERROR: Publisher hudson.plugins.violations.ViolationsPublisher aborted due to exception 
java.io.EOFException: input contained no data 
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003) 
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046) 
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410) 
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395) 
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093) 
at hudson.plugins.violations.parse.AbstractParser.expectNextTag(AbstractParser.java:262) 
at hudson.plugins.violations.types.pmd.PMDParser.execute(PMDParser.java:39) 
at hudson.plugins.violations.parse.AbstractTypeParser.parse(AbstractTypeParser.java:57) 
at hudson.plugins.violations.ViolationsCollector.doType(ViolationsCollector.java:187) 
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:114) 
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:25) 
at hudson.FilePath.act(FilePath.java:904) 
at hudson.FilePath.act(FilePath.java:877) 
at hudson.plugins.violations.ViolationsPublisher.perform(ViolationsPublisher.java:74) 
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) 
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:802) 
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:774) 
at hudson.model.Build$BuildExecution.post2(Build.java:183) 
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:724) 
at hudson.model.Run.execute(Run.java:1600) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 
at hudson.model.ResourceController.execute(ResourceController.java:88) 
at hudson.model.Executor.run(Executor.java:237) 
Finished: FAILURE 
+0

在詹金斯項目滾動的配置部分倒有一點「發佈HTML報告」,如果你刪除「代碼瀏覽器」一本錯誤消失。但是對於我來說,其他人會彈出。我認爲「jenkins-php.org」模板似乎根本無法使用。也許它很過時? – DarsVaeda 2013-05-02 16:47:47

回答

2

對於您的配置文件,您可以從http://jenkins-php.org站點複製它們的代碼。大約3/4頁的例子是PHPUnit,phpDox,PHP_CodeSniffer和PHPMD。

至於在何處放置文件,您可以配置工作,以尋找他們幾乎在任何地方,但IIRC默認是把他們在build文件夾在你的項目的根目錄。

我們的項目的根目錄看起來是這樣的

root 
|-- build... 
| |-- phpmd.xml 
| `-- phpunit.xml 
`-- src ... 
| |-- our PHP applications code 
| `-- ... 
`-- build.xml 

如果你的配置文件的所有排序,你仍然有錯誤,我想看看權限問題,也知道什麼操作系統,這是上運行,並且你如何安裝詹金斯可能幫助(APT包VS手動下載並安裝)

+0

謝謝,我通過apt-get安裝。我在Ubuntu 13.04上使用這種配置。看起來它有助於將這些文件複製到生成文件夾,並將它們放在根目錄中。 但我仍然得到錯誤在構建結束,它無法複製文件... – DarsVaeda 2013-05-01 21:09:03

+0

如果解決您的問題,那麼請接受,我試圖建立我代表:) – Rockstar04 2013-05-01 21:12:54

+0

我投你了,因爲它部分解決了,但最後的實際錯誤仍未解決。非常感謝你! :) – DarsVaeda 2013-05-01 21:25:40

1

你的第一個例外是

phpmd-ci: 
[exec] Cannot find specified rule-set "/var/lib/jenkins/jobs/MyDemo/workspace/build/phpmd.xml". 
[exec] Result: 1 

我認爲THI s配置文件已過時。這就是爲什麼沒有找到規則集。 我能夠通過在那裏定義規則集來更改build.xml文件來解決它。

原始phpmd配置:

<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server"> 
    <exec executable="phpmd"> 
    <arg path="${basedir}/src" /> 
    <arg value="xml" /> 
    <arg value="${basedir}/build/phpmd.xml" /> 
    <arg value="--reportfile" /> 
    <arg value="${basedir}/build/logs/pmd.xml" /> 
    </exec> 
</target> 

更改配置:

<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server"> 
    <exec executable="phpmd"> 
    <arg path="${basedir}/src" /> 
    <arg value="xml" />   
    <arg value="codesize,unusedcode,naming,design" /> 
    <arg value="--reportfile" /> 
    <arg value="${basedir}/build/logs/pmd.xml" /> 
    </exec> 
</target> 

phpmd現在會生成一個報告文件,你的最後一個異常就會迎刃而解了。

0

嘗試創建文件phpdox.xml 有以下內容:

<?xml version="1.0" encoding="utf-8" ?> 
<phpdox xmlns="http://xml.phpdox.net/config"> 
    <project name="phpdox" source="../library" workdir="../build/phpdox"> 
     <collector publiconly="false"> 
      <include mask="../**/*.php" /> 
      <exclude mask="../vendor/**"/> 
      <exclude mask="*Autoload.php" /> 
     </collector> 

     <generator output="../build"> 
      <build engine="html" enabled="true" output="api"> 
       <file extension="html" /> 
      </build> 
     </generator> 
    </project> 
</phpdox> 

我希望它可以幫助你。