Hudson/Jenkins PMD 配置 [英] Hudson/Jenkins PMD Configuration

查看:28
本文介绍了Hudson/Jenkins PMD 配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Jenkins 的新手,刚刚开始配置它.这就是我到目前为止所做的:

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

  1. 安装并配置 Jenkins 以显示主页.添加了 PMD 插件.
  2. HUDSON_HOME 设置为特定目录 > C:\Work\Jenkins
  3. 配置了一个测试构建来运行一个简单的什么都不做的蚂蚁脚本.运行成功

  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

编写了一个独立的 pmdbuild.xml 来对 C:\myview 中的一组文件运行检查(我使用的是 clearcase).此 xml 还将输出 pmd_results.xml 复制到 $HUDSON_HOME/[job-name]/workspace

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

现在我添加了 pmdbuild.xml 作为主要构建中的一个步骤.所以我的构建有两个步骤:一种.运行一个简单的脚本,什么都不做.湾运行生成 pmd_results.xml 的 pmdbuild.xml 并将其放置在 $HUDSON_HOME/[job-name]/workspace(硬编码为Jenkins PMD 插件需要该文件)

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)

Jenkins 使用插件自动获取 pmd_results.xml 并显示警告和所有内容.

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

现在的问题:

  • 如果我点击 PMD 结果中的文件名,它会给出一个 filenotfound 异常,因为它正在 $HUDSON_HOME/[job-name]/中寻找源文件工作区.

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

我的java代码文件放在C:\myview(一个clearcase快照视图)

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

我的问题是,我是否需要将所有代码文件都放在 $HUDSON_HOME/[job-name]/workspace 中??意思是我不能告诉 Jenkins 在 C:\myview 或任何其他目录中查找 PMD 输入文件而不是 $HUDSON_HOME/[job-name]/workspace ??

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

抱歉太长的描述.

推荐答案

Jenkins 希望所有代码都在工作区中.通常使用 Jenkins 将代码的副本检出到工作区中,然后在工作区中的 Sources 上运行所有构建步骤.

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.

乍一看似乎有些拘束,但如果您需要将 Jenkins 移动到另一台服务器或创建从属实例,它会为您省去很多麻烦.

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.

所以我建议你让 Jenkins 检出你的代码(应该有一个 clearcase 插件)到工作区中,并对检出的代码运行分析.

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.

如果有令人信服的理由为什么您的代码必须保持原样(在您的情况下为 C:\myview),您仍然可以将构建的工作区设置为该目录(在作业配置页面中找到它,您需要单击扩展"按钮以查看选项).

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

这篇关于Hudson/Jenkins PMD 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆