您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > Hudson插件开发简介
Hudson插件开发了解Hudson开发Hudson插件WhatisHudson/Jenkins?Hudsonmonitorsexecutionsofrepeatedjobs,suchasbuildingasoftwareprojectorjobsrunbycron.Amongthosethings,currentHudsonfocusesonthefollowingtwojobs:Building/testingsoftwareprojectscontinuously,justlikeCruiseControlorDamageControl.Inanutshell,Hudsonprovidesaneasy-to-useso-calledcontinuousintegrationsystem,makingiteasierfordeveloperstointegratechangestotheproject,andmakingiteasierforuserstoobtainafreshbuild.Theautomated,continuousbuildincreasestheproductivity.Monitoringexecutionsofexternally-runjobs,suchascronjobsandprocmailjobs,eventhosethatarerunonaremotemachine.Forexample,withcron,allyoureceiveisregulare-mailsthatcapturetheoutput,anditisuptoyoutolookatthemdiligentlyandnoticewhenitbroke.Hudsonkeepsthoseoutputsandmakesiteasyforyoutonoticewhensomethingiswrong.Hudson是一个CI服务器自动完成软件代码的编译和测试过程。使用CIServer会使您的工作变得容易简单、持续,自动编译过程帮助软件开发团队减少项目风险,提高工作效率和软件产品质量。1、发现bug更加容易;2、提供快速的反馈;3、隔离问题;4、确保一个持续可靠的buildFeaturesEasyinstallationEasyconfigurationChangesetsupportPermanentlinksRSS/E-mail/IMIntegrationAfter-the-facttaggingJUnit/TestNGDistributedbuildsFilefingerprintingPluginSupport:Hudsoncanbeextendedvia3rdpartyplugins.YoucanwritepluginstomakeHudsonsupporttools/processesthatyourteamuses.可扩展的功能点Hudson定义了一些功能点,是以接口或者抽象类出现的。需要对某个功能作扩展时,需要实现相应的接口或者抽象类。目前可扩展的功能点(78个):AdministrativeMonitor,AuthorizationStrategy,Axis,BuildWrapper,Builder,CLICommand,ChangeLogAnnotator,Cloud,ComputerConnector,ComputerLauncher,ComputerListener,ComputerPinger,ConsoleAnnotationDescriptor,ConsoleAnnotatorFactory,ConsoleLogFilter,CrumbIssuer,Downloadable,ExtensionFinder,FileSystemProvisioner,FileSystemProvisionerDescriptor,ItemListener,Job,JobProperty,LabelAtomProperty,LabelFinder,LauncherDecorator,Lifecycle,ListViewColumn,LoadPredictor,MailAddressResolver,ManagementLink,MatrixAggregatable,MatrixAggregator,MyViewsTabBar,Node,NodeMonitor,NodeProperty,Notifier,PageDecorator,ParameterDefinition,PeriodicWork,PluginServletFilter,PluginStrategy,ProcessKiller,QueueDecisionHandler,QueueSorter,QueueTaskDispatcher,Recorder,RepositoryBrowser,RestartListener,RetentionStrategy,RootAction,Run,RunListener,SCM,SCMListener,SaveableListener,SecurityRealm,Solution,SubTaskContributor,TestDataPublisher,TestResultParser,ToolInstallation,ToolInstaller,ToolLocationTranslator,ToolProperty,TopLevelItem,TransientProjectActionFactory,TransientViewActionFactory,Trigger,UDPBroadcastFragment,UpdateCenterConfiguration,UserNameResolver,UserProperty,View,ViewJobFilter,ViewsTabBar,Widget编写Hudson插件搭建基本环境开发与调试发布与部署搭建基本环境JDK必须是1.6以上的Maven必须是2.0以上Maven配置修改settings.xml文件,加入下面的内容。settingspluginGroupspluginGrouporg.jvnet.hudson.tools/pluginGroup/pluginGroups/settings工程创建进入插件工程所要放到目录,使用maven命令创建工程$mvn-cpuhpi:create提示你填写groupId(包名)和artifactId(项目工程名)如果使用eclipse开发,可使用maven命令导入eclipse工程结构$mvn-DdownloadSources=true-DdownloadJavadocs=true-DoutputDirectory=target/eclipse-classeseclipse:eclipse如果eclipse带有maven的插件,则可免去此步,直接使用eclipse导入maven项目。插件的开发引入成功后,会显示如示结构。工程中会带有官方的helloworld。插件实现类。HelloWorldBuilder是我们所要编写的插件类,需实现相应的Hudson扩展点。插件的文件包。对此插件的一些配置、展现的页面。3、index.jelly插件的基本描述信息。4、pom.xmlmaven配置文件,打包时用到。插件的调试运行测试在工程目录下,运行mvnhpi:run,会启动自带的jetty。在启动调试之前,你先确定端口8080没被占用,如果被占用个,我们可以用命令mvnhpi:run–Djetty.port=****来更改端口号打开浏览器即可进入hudson页面,查看、运行插件了。debug测试1.启动debug模式运行mvnDebughpi:run启动,可通过8000端口进行远程调试。如果不想用8000端口,需运行以下命令启动setMAVEN_OPTS=-Xdebug-Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=nmvnhpi:run2.Eclipse中进行调试在工程上,使用RemoteJavaApplication进行调试插件的发布可采用以下两种方式发布。①在工程目录下,使用命令mvnpackage进行打包。②使用带maven插件的eclipse,在项目上右键-Runas-MavenPackage打包完成后,会在工程目录下创建一个target目录,里面是打包的结果。其中.hpi是Hudson用到的插件包。插件的部署Hudson界面部署系统配置中,“插件管理”选项。手动部署将hpi文件拷贝到web应用中,hudson目录下的WEB-INF/plugins下。部署完成后,重启Hudson即可生效更多内容。。。佛高一尺,道高一丈相信大家会对hudson插件有更好的了解ThankYou
本文标题:Hudson插件开发简介
链接地址:https://www.777doc.com/doc-3445683 .html