为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

hudson 持续集成_20131021

2013-10-21 26页 pdf 1019KB 15阅读

用户头像

is_580749

暂无简介

举报
hudson 持续集成_20131021 官网:http://www.pmease.com/ 参考:http://jdonee.iteye.com/blog/315440 使用 hudson hudson-3.0.1.war Hudson 配置 HudsonHudsonHudsonHudson出现的问题 (1) ERROR: No artifacts found that match the file pattern "D:\Temp\bb". Configuration error? ERROR: 'D:\Temp\bb' doesn't match...
hudson 持续集成_20131021
官网:http://www.pmease.com/ 参考:http://jdonee.iteye.com/blog/315440 使用 hudson hudson-3.0.1.war Hudson 配置 HudsonHudsonHudsonHudson出现的问 (1) ERROR: No artifacts found that match the file pattern "D:\Temp\bb". Configuration error? ERROR: 'D:\Temp\bb' doesn't match anything: even 'D:' doesn't exist (2) ERROR: Publisher hudson.tasks.ArtifactArchiver aborted due to exception 错误原因: 修改为: 又出现问题: (3) [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored 解决方法: org.apache.maven.plugins maven-war-plugin 2.4 target/${project.artifactId} src/main/webapp **/demoForm.jsp src/main/webapp/WEB-INF/web.xml (4)hudson pending - Waiting for next available executor 原因:因为磁盘空间不够,导致 maste不可用 解决方法: 点击右上角的“makemakemakemake thisthisthisthis nodenodenodenode backbackbackback onlineonlineonlineonline”,刷新就 ok 了 也 可 以 参 考 : http://stackoverflow.com/questions/15112890/jenkins-not-executing-jobs-pending-waiting-for-n ext-executor (5)pom.xml 中启动 tomcat 时,启动的是 hudson 所在 tomcat,导致如下错误: 如何执行指定的 tomcat 呢? 通过 hudson 设置环境变量: Manager Hudson-Configure System 关键是要设置上图中红框中的内容。 (6)maven-antrun-plugin 插件的 tasks 中可以有多个 echo吗? 可以。 (7)tomcat 停止失败也继续 执行 mvn antrun:run 时,先停 tomcat(不管此时 tomcat 是否启动),然后才启动 tomcat, 如果 failonerror的值为 true,则停止失败就会直接退出,不会再启动 tomcat; 设置 failonerror 的值为 false,停止 tomcat失败也会启动 tomcat (8)运行 checkstyle 时报错: Could not find resource 'config/checkstyle_checks.xml'. -> [Help 1] (9) HudsonHudsonHudsonHudson配置 SystemSystemSystemSystemConfigurationsConfigurationsConfigurationsConfigurations 设置环境变量 增加两个环境变量:CATALINA_BASE, CATALINA_HOME, CATALINA_TMPDIR MavenMavenMavenMaven 3333 SNAPSHOTSNAPSHOTSNAPSHOTSNAPSHOTMonitorMonitorMonitorMonitor nexusnexusnexusnexus 服务的用户名和密码 设置邮件 详情请参阅 Hudson 邮件设置。 集成测试 mavenmavenmavenmaven命令 mvn antrun:run install mvn pmd:pmd pmd:check tomcattomcattomcattomcat 的启动和停止 把 tomcat 的启动绑定到 mvn clean,为什么? (1) 必须在 integration-test之前启动 tomcat; (2) 若绑定到 DefaultDefaultDefaultDefault LifecycleLifecycleLifecycleLifecycle,则 tomcattomcattomcattomcat会启动两次 fds clean run 执行 antrun:run 启动 tomcat 执行 mvn install 时,关闭(停止)tomcat org.apache.maven.plugins maven-antrun-plugin 1.7 ccc install run ant ant-junit 1.6.2 findbugsfindbugsfindbugsfindbugs 参考资料: http://mojo.codehaus.org/findbugs-maven-plugin/findbugs-mojo.html http://hw1287789687.iteye.com/admin/blogs/1960322 http://hw1287789687.iteye.com/admin/blogs/1960331 http://stackoverflow.com/questions/8975096/maven-checkstyle-configlocation-ignored findbugs 分析的是 class 文件,而不是 java 源文件 需要在两个地方配置: (1) 项目的 pom.xml; (2) Hudson job 的配置 pompompompom配置 在 build/plugins 中添加: org.codehaus.mojo findbugs-maven-plugin true true true HudsonHudsonHudsonHudson jobjobjobjob 配置 回到 job dashboard,点击“configure” 要注意的地方 findbugs:findbugsfindbugs:findbugsfindbugs:findbugsfindbugs:findbugs必须写在最后 Goals and options:填写诸如 clean install findbugs:findbugs 或 compile findbugs:findbugs 此类的,注意, clean findbugs:findbugs install ,这种写法是错的,可以运行的,但是并不产生 findbugs 报告,再次坑爹。 为什么呢? 因为 findbugs 依赖项目编译后的 classclassclassclass文件,它分析的是 class 文件,而不是 java 源文件。 参阅 http://findbugs.sourceforge.net/ 。 FindBugs requires JRE (or JDK) 1.5.0 or later to run. However, it can analyze programs compiled for any version of Java 总结:findbugs:findbugs一定要在 compile 生命周期后面 有时运行 mvnmvnmvnmvn findbugs:findbugsfindbugs:findbugsfindbugs:findbugsfindbugs:findbugs 时,没有扫描出 bugbugbugbug(实际上有 bugbugbugbug) 原因:findbugs 需要 class 文件,不需要 java 文件。 FindBugs requires JRE (or JDK) 1.5.0 or later to run. However, it can analyze programs compiled for any version of Java 解决方法: mvn test findbugs:findbugs 因为 test 会触发 compile 生命周期 findbugsfindbugsfindbugsfindbugs生成的结果是 xmlxmlxmlxml,不方便看 解决方法:使用 findbugs 的 GUI 界面,详情请参阅 findbugs GUI 查看缺陷。 查看 findbugsfindbugsfindbugsfindbugs报告 在哪儿查看 findbugs 报告呢? (1) 点击 status: (2) 点击 status 之后,出现如下界面(看右边的 Permalinkss) findbugsfindbugsfindbugsfindbugs 常用命令 mvn findbugs:help 查看 findbugs 插件的帮助 mvn findbugs:check 检查代码是否通过 findbugs 检查,如果没有通过检查,检查会失 败,但检查不会生成结果报 mvn findbugs:findbugs 检查代码是否通过 findbugs 检查,如果没有通过检查,检查不会失 败,会生成结果报表保存在 target/findbugsXml.xml 文件中 mvn findbugs:gui 检查代码并启动 gui 界面来查看结果 命令行运行 步骤: (1) 打开 cmd; (2) 进入项目所在路径; (3) 运行 mvn findbugs:findbugs 运行结果: target 目录的变化: 检查 findbugsfindbugsfindbugsfindbugs 是否通过 再命令行中运行 mvn findbugs:check: findbugsfindbugsfindbugsfindbugs GUIGUIGUIGUI查看缺陷 在 cmd 窗口中运行:mvn findbugs:gui,会自动弹出 GUI 界面: checkstylecheckstylecheckstylecheckstyle 参考资料:http://darkranger.iteye.com/blog/657737 http://blog.blundell-apps.com/create-your-own-checkstyle-check/ http://stackoverflow.com/questions/8975096/maven-checkstyle-configlocation-ignored pompompompom配置: org.apache.maven.plugins maven-checkstyle-plugin 2.9.1 org.apache.maven.plugins maven-jxr-plugin 2.3 要注意的地方 ( 1 ) 运 行 mvn checkstyle:checkstyle 时 , 没 有 执 行 reporting 中 的 maven-checkstyle-plugin插件 The usage is for mvn site 只有运行 mvnmvnmvnmvn sitesitesitesite才会调用 reportingreportingreportingreporting中的插件。 如果要在执行 mvn checkstyle:checkstyle 时,使用自定义的配置文件,怎么办? 在 pom.xml 中增加: properties/checkstyle-configuration.xml< /checkstyle.config.location> 运行 mvn site 运行 checkstyle 时,pom 配置如下: org.apache.maven.plugins maven-jxr-plugin 2.3 org.apache.maven.plugins maven-checkstyle-plugin 2.10 ${checkstyle.config.location} 注意: (a)reporting与 build是同级目录 (b)需要在 properties 设置 checkstyle.config.locationcheckstyle.config.locationcheckstyle.config.locationcheckstyle.config.location属性。 (2)在 reporting 中添加了 findbugs-maven-plugin 插件,运行 mvn site 时无 findbugs报告 原因:findbugs-maven-plugin扫描的是 class文件(编译后的文件),而不 是 java源文件 checkstylecheckstylecheckstylecheckstyle 常用命令 mvn checkstyle:help 查看 checkstyle-plugin 的帮助: mvn checkstyle:check 检查是否满足 checkstyle 的检查,如果没有满足,检查 会失败,可以通过 target/site/checkstyle.html 查看。 mvn checkstyle:checkstyle 检查工程是否满足 checkstyle 的检查,如果没有满足,检查不 会失败,可以通过 target/site/checkstyle.html 查看。 mvn checkstyle:checkstyle-aggregate 检查工程是否满足 checkstyle 的检查,如果没有满 足,检查不会失败,可以通过 target/site/checkstyle.html 查看。 生成 checkstylecheckstylecheckstylecheckstyle 报告 mvn checkstyle:checkstyle 改进为:mvn checkstyle:checkstyle jxr:jxr site 改进为:mvn test site 改进为:mvn checkstyle:checkstyle jxr:jxr site 改进为:mvn test site jxr:jxr 要想生成完成的 htmlhtmlhtmlhtml形式的测试报告 配置 pom.xml: org.apache.maven.plugins maven-site-plugin org.codehaus.mojo findbugs-maven-plugin 2.5.2 org.apache.maven.plugins maven-checkstyle-plugin 2.9.1 org.apache.maven.plugins maven-jxr-plugin 2.3 按照上述 pom,。尽管可以生成 checkstyle 和 findbugs 的报告,但是没有代码的超链接: 在 cmd 中运行:mvnmvnmvnmvn sitesitesitesite jxr:jxrjxr:jxrjxr:jxrjxr:jxr target 目录的变化: 打开网页,界面如下: 在 hudsonhudsonhudsonhudson 界面显示 checkstylecheckstylecheckstylecheckstyle 结果 build 玩之后就可以看到 checkstyle 的结果了: eclipseeclipseeclipseeclipse 中 checkstylecheckstylecheckstylecheckstyle插件的使用 指定自定义的 checkstylecheckstylecheckstylecheckstyle配置文件 checkstyle.xml UTF-8 HudsonHudsonHudsonHudson 安装插件 步骤: (1) 点击 回到主面板; (2) 点击 ,弹出如下界面: (3) 点击 ,进入如下界面: (4) 点击上图中的“Available”标签页,弹出如下界面: (5) 点击“search”标签页: (6) 在上述文本框中输入插件的名称,然后点击【Search】按钮: (7) 选中要安装的插件,点击【Install】按钮: croncroncroncron 0 */2 * * * 每两个小时 0 */1 * * * 每一个小时执行一次 */3 * * * * 每隔三分钟执行一次 */1 * * * * 每隔一分钟执行一次 每天的 18 点到第二天 9 点之间每隔 10 分钟 执行 1 * * * * 每小时的第一分钟 10 * * * * 每小时的十分钟执行一次 HudsonHudsonHudsonHudson 邮件设置 使用 163163163163服务器 邮件服务器:smtp.163.com 使用天地融服务器 邮件服务器:smtp.tendyron.com 网页版邮箱地址:http://mail.tendyron.com/#lang=cn System Admin E-mail Address :whuang@tendyron.com 使用 hudsonhudsonhudsonhudson构建项目----具体 什么时候构建? � 构建频率 第一种情况:不运行集成测试 每隔 10 分钟扫描,若 svn 有提交,则进行构建 � 选项说明 • PollPollPollPoll SCMSCMSCMSCM : 这是 CI 系统中常见的选项。当您选择此选项,您可以指定一个定时作业表达式来定 义 Hudson 每隔多久检查一下您源代码仓库的变化。如果发现变化,就执行一次构建。例如,表达式 中填写 0,15,30,45 * * * *将使 Hudson每隔 15分钟就检查一次您源码仓库的变化。更多信息请查阅 Quartz CronTrigger 中关于这个定时作业语法的详细描述(新版 Quartz支持从秒开始触发,所以请 查阅下面的 cron帮助,对此引起的误导表示歉意)。 第二种情况: 每天 20:00-第二天 9:00 跑一遍集成测试, � 实现 每隔 10 分钟构建 构建 clean antrun:run pmd:pmd checkstyle:checkstyle compile findbugs:findbugs install 问题 (1)集成测试不通过没法继续执行 clean 启动 tomcat pmd checkstyle 集成测试 部署到 tomcat compile findbugs deploy 打包 Hudson配置 Hudson出现的问题 Hudson配置 SystemConfigurations 设置环境变量 Maven3SNAPSHOTMonitor 设置邮件 集成测试maven命令 tomcat的启动和停止 findbugs pom配置 Hudsonjob配置 要注意的地方 findbugs:findbugs必须写在最后 有时运行mvnfindbugs:findbugs时,没有扫描出bug(实际上有bug) findbugs生成的结果是xml,不方便看 查看findbugs报告 findbugs常用命令 命令行运行 检查findbugs是否通过 findbugsGUI查看缺陷 checkstyle pom配置: 要注意的地方 checkstyle常用命令 生成checkstyle报告 要想生成完成的html形式的测试报告 在hudson界面显示checkstyle结果 eclipse中checkstyle插件的使用 指定自定义的checkstyle配置文件 Hudson安装插件 cron Hudson邮件设置 使用163服务器 使用天地融服务器 使用hudson构建项目-具体设计 什么时候构建? 构建流程
/
本文档为【hudson 持续集成_20131021】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索