Hudson/Jenkins PMD Configuration

末鹿安然 提交于 2019-12-12 14:11:27

问题


I am new to Jenkins and just started configuring it. This is what i have done till now:

  1. Installed and configured Jenkins to display the home page. Added PMD plugin.
  2. Set the HUDSON_HOME to a specific directory > C:\Work\Jenkins
  3. Configured a test build to run a simple do-nothing ant script. It runs successfully

  4. Written an independent pmdbuild.xml to run checks on a set of files in C:\myview (I am using clearcase). This xml also copies the output pmd_results.xml to the workspace directory in $HUDSON_HOME/[job-name]/workspace

  5. Now I added the pmdbuild.xml as a step in my primary build. So my build has 2 steps: a. Run a simple script, do-nothing. b. Run pmdbuild.xml which generate pmd_results.xml and place it in $HUDSON_HOME/[job-name]/workspace (HARD-CODED as Jenkins PMD plugin expects the file there)

  6. Jenkins picks up the pmd_results.xml automatically with the plugin and displays warnings and everything.

Now the problem:

  • If I click on a filename in the PMD results, it gives a filenotfound exception as it is looking for the source file in $HUDSON_HOME/[job-name]/workspace.

  • My java code files are placed in C:\myview (a clearcase snapshot view)

My question is, do I need all my code files to be present inside $HUDSON_HOME/[job-name]/workspace ?? Meaning can't I tell Jenkins to look for the PMD input files in C:\myview or any other directory instead of $HUDSON_HOME/[job-name]/workspace ??

Sorry for the extremely long description.


回答1:


Jenkins expects that all the code is in the workspace. Usually Jenkins is used to check out a copy of the code into the workspace, and then runs all build steps on the Sources in the Workspace.

Might seem restraining at first, but it saves you a lot of trouble if you need to move Jenkins to another server, or create a slave instance.

So I would suggest you let Jenkins check out your code (there should be a clearcase plugin) into the workspace, and run the analysis on the checked out code.

If there are compelling reasons why your code has to stay where it is (C:\myview in your case) you can still set the workspace of your build to that directory (find this in the job configuration page, you need to click on the 'extended' button to see the option).



来源:https://stackoverflow.com/questions/7950255/hudson-jenkins-pmd-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!