steros
steros

Reputation: 1924

jenkins setting up a php project - errors in log

So using jenkins-php.org I tried to setup a project. Unfortunately I get errors. First of all where do I put those xml configuration files it asks for (phpmd and phpcd)? And are there some standard configurations I can use as a starting point?

But most prominently what is going on at the end of the log? How do I fix that error?

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/MyDemo/workspace
Checkout:workspace / /var/lib/jenkins/jobs/MyDemo/workspace - hudson.remoting.LocalChannel@de895e
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

Upvotes: 1

Views: 5660

Answers (3)

Tomasz Kuter
Tomasz Kuter

Reputation: 666

Try to create file phpdox.xml with following content:

<?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>

I hope it helps you.

Upvotes: 0

Simon H
Simon H

Reputation: 2495

Your first Exception is

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

I think this configurationfile is outdated. That's why the ruleset wasn't found. I was able to solve it through changing the build.xml file through defining the rulesets there.

Original phpmd config:

<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>

Changed config:

<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 will now generate a report file and your last exception will be solved, too.

Upvotes: 1

Rockstar04
Rockstar04

Reputation: 409

For your configuration files, you can copy the code for them from the http://jenkins-php.org site. About 3/4 of the way down the page there are examples of PHPUnit, phpDox, PHP_CodeSniffer, and PHPMD.

As for where to put the files, you can configure the job to look for them almost anywhere, but IIRC the default is to put them in the build folder in your projects root dir.

Our projects root directory looks something like this

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

If you get the configuration files all sorted and you still have the errors I would look at a permissions issue, also knowing what OS this is running on and how you installed Jenkins might help (Apt package vs manual download and install)

Upvotes: 2

Related Questions