问题
I am new to Jenkins and just started configuring it. This is what i have done till now:
- Installed and configured Jenkins to display the home page. Added PMD plugin.
- Set the
HUDSON_HOME
to a specific directory > C:\Work\Jenkins Configured a test build to run a simple do-nothing ant script. It runs successfully
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
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 generatepmd_results.xml
and place it in$HUDSON_HOME/[job-name]/workspace
(HARD-CODED as Jenkins PMD plugin expects the file there)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