基于 Jenkins 平台的二次开发环境设置方法
来源:互联网 发布:unity3d 布料系统demo 编辑:程序博客网 时间:2024/06/05 04:55
3年多没有在csdn上写blog了, 今天偶然和 念茜(http://blog.csdn.net/yiyaaixuexi) 聊了几句,看到她最近写了这么多的技术blog, 我也上一点干货吧。
首先介绍一下什么是Jenkins :
持续集成是一种软件开发实践,对于提高软件开发效率并保障软件开发质量提供了理论基础。Jenkins 是一个开源软件项目,旨在提供一个开放易用的软件平台,使持续集成变成可能。 http://www.ibm.com/developerworks/cn/java/j-lo-jenkins/index.html
介绍Jenkins 的使用不是本文的重点, 本文的重点是如何把 Jenkins 作为一个基础平台, 在上面做二次开发。
===================
Jenkins 平台有大量的 UI、远程控制、编译、部署、监控等等插件。
我们这次的项目需求是开发一个业务运维平台, 对整个系统设置大量的监控点, 以各种可视化方式输出实时的系统状态图表, 在Jenkins 平台进行二次开发是一个合适的方案。
我最终还是用 mvn+jetty的方法来开发jenkins插件, 实际用下来感觉也还不错~~
也算是一个很有用的技能。
(eclipse远程调试)
http://www.ibm.com/developerworks/cn/opensource/os-eclipse-javadebug/index.html
sample 项目:
https://sourcer.yunrang.com/svn/yr/projects/branches/develop/ads/szpilot/plugins/ui-samples-plugin
先确保 %USERPROFILE%\.m2\settings.xml有以下内容, 同时, 需要 maven 3.0.4版本 , 升级方法不麻烦, 见之前的邮件。
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<profiles>
<!-- Give access to Jenkins plugins -->
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault> <!-- change this to false, if you don't like to have it on per default -->
</activation>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
然后在插件源码目录里执行
mvn -DdownloadSources=true -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes eclipse:eclipse
然后就可以用 mvn package 打包,
开发的时候, 用 mvn hpi:run 看结果, 调试。
用浏览器访问 http://localhost:8080/
============================
同时, 还需要做的事情是:
检出
https://github.com/jenkinsci/jenkins
执行
mvn eclipse:eclipse
然后导入eclipse, 默认会是 jdk1.5的工作空间, 需要去 java-compile 和 build-path -> library 改成 1.6的环境, 比较好, 可以没有红色报错。
==========================
全部做完, 就能在eclipse里开发代码, 并在浏览器里查看效果了。
========================================
调试方法:
$ export MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n"
$ mvn hpi:run
在mvn hpi:run启动过程中, 在eclipse debug attach, 慢了会失败,连不上。
jenkins插件开发方法:
https://wiki.jenkins-ci.org/display/JENKINS/Defining+a+new+extension+point
Creating a New Plugin
To start a new plugin, run the following Maven command:
$ mvn -cpu hpi:create
This will ask you a few questions, like the groupId (the Maven jargon for the package name) and the artifactId (the Maven jargon for your project name), then create a skeleton plugin from which you can start with. Make sure you can build this:
$ cd newly-created-directory
$ mvn package
Explanations:
-cpu means that Maven should update all relevant Maven plugins (check for plugin updates)
hpi: this prefix specifies that the Jenkins HPI Plugin is being invoked, a plugin that supports development of Jenkins plugins
create is the goal which creates the directory layout and the POM for your new Jenkins plugin and it adds it to the module list
package is a standard phase which compiles all sources, runs the tests and creates a package - when used by the HPI plugin it will create an *.hpi file
Building a Plugin
To build a plugin, run mvn install. This will create the file ./target/pluginname.hpi that you can deploy to Jenkins.
$ mvn install
=================
- 基于 Jenkins 平台的二次开发环境设置方法
- 基于Anydesk+TeamViewer二次开发的互助平台
- Openfire3.9.3基于Eclipse的Android消息推送服务平台二次开发环境搭建
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的UI自动化测试环境
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的自动化测试环境
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的UI自动化测试环境
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的UI自动化测试环境
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的UI自动化测试环境
- (jenkins)hudson平台搭建android项目持续化集成以及基于NativeDriver的UI自动化测试环境
- 基于 jenkins 和 docker 的持续集成平台
- 基于 jenkins 和 docker 的持续集成平台
- 基于Visio的二次开发
- 基于eclipse的python开发平台的安装配置和代码编写环境主题设置
- 基于openstack二次开发IaaS平台:Solid
- 构建基于Jenkins + Github的持续集成环境
- 构建基于Jenkins + Github的持续集成环境
- 构建基于Jenkins + Github的持续集成环境
- Jenkins + Unity + Android构建基于Unity的自动编译环境
- ruby 操作MongoDB
- 关于获取屏幕区域RECT
- Win8 从图片库 选择图片,并上传到应用,设着为背景
- boost正则表达式规则
- ArcGIS实用制图技巧——如何制作“浮雕”效果的多边形
- 基于 Jenkins 平台的二次开发环境设置方法
- jackrabbit注入到spring中的基本操作
- iOS工程中的info.plist文件的完整研究
- Android ListView从网络获取图片及文字显示
- ruby gem常用命令
- 简单介绍performance_schema数据库
- ArcGIS实用制图技巧——如何制作“光照”效果的水体多边形
- 【图像处理】利用积分图像法快速计算Haar特征
- 工信部软件大赛决赛题----统计连通图的个数和面积