Hudson/Jenkins PMD 配置

发布于 2024-12-13 03:22:19 字数 1113 浏览 2 评论 0原文

我是詹金斯的新手,刚刚开始配置它。这就是我到目前为止所做的:

  1. 安装并配置 Jenkins 以显示主页。添加了 PMD 插件。
  2. HUDSON_HOME 设置为特定目录 > C:\Work\Jenkins
  3. 配置了一个测试构建来运行一个简单的不执行任何操作的 ant 脚本。它运行成功

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

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

  6. 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:

  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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

远山浅 2024-12-20 03:22:19

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文