首先感谢文章末尾链接的博客博主。
另外如果我的文章出现了VIP才能看,请及时通知我,我进行权限修改。最近登陆账号看自己的博客,有很多添加了VIP。我都不知道。希望我的博客能对各位有用。
1:工作准备
jdk17/jdk21
,否则Jenkins不兼容。
jdk17/jdk21
下载地https://www.oracle.com/java/technologies/downloads
Jenkins
下载地址https://www.jenkins.io/zh/download/
vs_BuildTools.exe
下载地址,用来编译和运行需要C++支持的程序或库,根据需要安装https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools
2:Jenkins配置
默认上面都已经安装通过。
在 Available plugs 里面搜索
Subversion 、 cmake 、 msbuild
和Email
的插件
阿里邮箱
smtp
: smtp.qiye.aliyun.com
端口 465
2.2 jenkins系统配置环境
2.3 邮箱配置
<html>
<head>
<meta charset="UTF-8">
<title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title>
</head>
<body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4"
offset="0">
<table width="95%" cellpadding="0" cellspacing="0" style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
<tr>
本邮件由系统自动发出,无需回复!<br/>
各位同事,大家好,以下为${PROJECT_NAME }项目构建信息</br>
<td><font color="#CC0000">构建结果 - ${BUILD_STATUS}</font></td>
</tr>
<tr>
<td><br />
<b><font color="#0B610B">构建信息</font></b>
<hr size="2" width="100%" align="center" /></td>
</tr>
<tr>
<td>
<ul>
<li>项目名称 : ${PROJECT_NAME}</li>
<li>构建编号 : 第${BUILD_NUMBER}次构建</li>
<li>触发原因: ${CAUSE}</li>
<li>构建状态: ${BUILD_STATUS}</li>
<li>构建日志: <a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
<li>构建 Url : <a href="${BUILD_URL}">${BUILD_URL}</a></li>
<li>工作目录 : <a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>
<li>项目 Url : <a href="${PROJECT_URL}">${PROJECT_URL}</a></li>
</ul>
<h4><font color="#0B610B">失败用例</font></h4>
<hr size="2" width="100%" />
$FAILED_TESTS<br/>
<h4><font color="#0B610B">最近提交(#$SVN_REVISION)</font></h4>
<hr size="2" width="100%" />
<ul>
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="<li>%d [%a] %m</li>"}
</ul>
详细提交: <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a><br/>
</td>
</tr>
</table>
</body>
</html>
测试的邮箱
3. 项目配置
注意
上面如果配置邮箱出现了SSL问题的话,请自行上网搜索解决。
参考:https://blog.csdn.net/weixin_49668036/article/details/139597520
https://blog.csdn.net/weixin_38319647/article/details/75451972
邮箱配置参考:https://blog.csdn.net/yayazhai0226/article/details/118698430
https://blog.csdn.net/GLYX5717/article/details/119747860
jenkins自动打包参考:https://zhuanlan.zhihu.com/p/680609818
https://blog.csdn.net/zls365365/article/details/125775856