Jenkins 用于 Maven 项目 - 生成测试报告
我使用 Jenkins 1.450 进行 CI,我的源代码位于 git 存储库中,并且使用 Maven 作为构建环境。
我的问题:我无法让 Jenkins 生成测试结果。
详细信息:
1.如果我在 Jenkins 中创建一个“自由式”作业,它会成功执行构建。但是,如果我选择“发布 JUnit 测试结果报告”选项,Jenkins 将找不到测试报告文件。如果我自己执行“mvn install”,我可以在 target/surefire-reports/ 中看到它们,但 Jenkins 不知何故没有在工作场所中构建...在 Jenkins 构建之后,我没有看到创建的目标目录。
2。如果我创建“Maven 2/3”作业,并为其提供 Maven 安装路径,Jenkins 根本找不到它 - 它说:
即使向所有用户授予此目录的读写执行权限后,该错误也不会改变。
我在这里做错了什么?我的 pom 文件中是否需要有
标记?我在哪里可以找到所有这些的文档/故障排除信息?
谢谢!
I am using Jenkins 1.450 for CI, my source code is in a git repo, and I am using maven as build environment.
My problem: I cannot get Jenkins to generate test results.
Details:
1. If I create a 'freestyle' job in Jenkins, it executes the build successfully. But, if I select the 'Publish JUnit test result report' option, Jenkins cannot find the test report files. I can see them in target/surefire-reports/ if I do 'mvn install' myself, but Jenkins somehow doesn't build in the workplace... after a Jenkins build, I don't see this target directory created.
2. If I create 'Maven 2/3' job, and give it path to my Maven installation, Jenkins simply does not find it - it says: <path>/Maven_3.0.4 doesn't have a 'lib' subdirectory - thus cannot be a valid maven installation!
The error doesn't change even after giving read-write-execute permissions to all users for this directory.
What is it that I am doing wrong here? Do I need to have the <reporting>
tag in my pom files? Where can I find documentation/troubleshooting info for all this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Maven 2/3 项目满足我们的测试报告要求。一旦我看到了这一点,我就继续解决构建同样的问题。
我按照以下步骤安装 Maven: http://lukieb.wordpress.com/2011/02/15/installing-maven-3-on-ubuntu-10-04-lts-server/,然后确保在 Jenkins 中正确设置了 maven 安装路径。
当我们构建 Android 应用程序时,下一个问题是 ANDROID_HOME 变量 - 没有它,Jenkins 无法找到 Android SDK 位置。进行
导出
并没有帮助;它从来没有“卡住”。此外,Jenkins 和 echo $PATH 看到的PATH
不匹配。答案是修改/etc/profile
,并添加export ANDROID_HOME
,然后添加export PATH=$ANDROID_HOME:$PATH
。 (我从另一个 Stackoverflow 问题中得到了这个。)在这一切之后,现在我的 CI 设置正在工作。
[我接受这个答案,如果您需要更多信息,请告诉我......]
Maven 2/3 project satisfies our test-reports requirements. Once I saw that, I went ahead and figured out the problems in building the same.
I followed these steps to install Maven: http://lukieb.wordpress.com/2011/02/15/installing-maven-3-on-ubuntu-10-04-lts-server/, and then made sure that path to maven install was set properly in Jenkins.
As we are building Android applications, the next problem was ANDROID_HOME variable - Jenkins could not find Android SDK location without it. Doing a
export
didn't help; it never 'stuck'. Moreover, thePATH
seen by Jenkins and byecho $PATH
did not match. The answer was modifying/etc/profile
, and addingexport ANDROID_HOME
and thenexport PATH=$ANDROID_HOME:$PATH
there. (I got this from another Stackoverflow question.)After all this, now my CI setup is working.
[I am accepting this answer, please let me know if you need further info...]
我也有同样的问题。对于 Ubuntu 14.04 上的我来说,
mvn
安装在/usr/share/maven/bin
中,但 Jenkins 真正要求的是 Mavenbin
的位置可以找到 code> 文件夹,它是:/usr/share/maven
。I had the same problem. For me on Ubuntu 14.04,
mvn
was installed in/usr/share/maven/bin
, but what Jenkins is really asking for is where the Mavenbin
folder can be found which is:/usr/share/maven
.