Hudson/Jenkins PMD 配置
我是詹金斯的新手,刚刚开始配置它。这就是我到目前为止所做的:
- 安装并配置 Jenkins 以显示主页。添加了 PMD 插件。
- 将
HUDSON_HOME
设置为特定目录 > C:\Work\Jenkins 配置了一个测试构建来运行一个简单的不执行任何操作的 ant 脚本。它运行成功
编写了一个独立的
中的workspace目录下pmdbuild.xml
来对C:\myview中的一组文件运行检查(我正在使用clearcase)。这个xml还将输出的pmd_results.xml复制到$HUDSON_HOME/[job-name]/workspace
现在我将
pmdbuild.xml
添加为我的主要构建步骤。所以我的构建有两个步骤: 一个。运行一个简单的脚本,什么也不做。 b.运行 pmdbuild.xml
生成pmd_results.xml
并将其放置在$HUDSON_HOME/[job-name]/workspace
中(硬编码为Jenkins PMD 插件需要该文件)Jenkins 使用插件自动获取
pmd_results.xml
并显示警告和所有内容。
现在的问题是:
如果我单击 PMD 结果中的文件名,它会给出
filenotfound
异常,因为它正在$HUDSON_HOME/[job-name] 中查找源文件/workspace
。我的java代码文件放置在C:\myview(一个clearcase快照视图)
我的问题是,我需要我的所有代码文件存在于 $HUDSON_HOME/[job-name]/workspace
中?这意味着我不能告诉 Jenkins 在 C:\myview 或任何其他目录中查找 PMD 输入文件而不是 $HUDSON_HOME/[job-name]/workspace
吗?
抱歉,描述太长了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Jenkins 希望所有代码都在工作区中。通常,Jenkins 用于将代码副本检出到工作区中,然后在工作区中的源上运行所有构建步骤。
乍一看可能有些限制,但如果您需要将 Jenkins 移动到另一台服务器或创建从属实例,它会为您节省很多麻烦。
所以我建议你让 Jenkins 将你的代码(应该有一个clearcase插件)签入工作区,并对签出的代码运行分析。
如果有令人信服的原因为什么你的代码必须保留在原来的位置(在你的例子中是 C:\myview),你仍然可以将构建的工作空间设置到该目录(在作业配置页面中找到它,你需要单击“扩展”按钮查看该选项)。
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).