Jenkins 插件开发
2019-01-11 16:19:24    1021    0    0
gua_l

整理中

 

jenkins 插件开发环境安装

https://jenkins.io/doc/developer/plugin-development/

 


安装jdk,并配置安装路径到path系统变量

https://www.oracle.com/technetwork/java/javase/downloads/index.html

安装maven

https://maven.apache.org/install.html
并配置安装路径到path系统变量

安装eclipse ,最新的eclipse 已经集成maven, m2e

https://www.eclipse.org/downloads/

可以在help-- about  eclipse --installtion details 中查看安装情况

本机安装jenkins ,并部署,见另一章 Window Jenkins 搭建


初始化jenkins 插件开发项目

https://jenkins.io/doc/developer/plugin-development/

https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial#Plugintutorial-Eclipse

http://maven.apache.org/guides/getting-started/index.html

 

1.修改 settings.xml文件(maven-dir/conf),主要是增加jenkins插件库的一些配置

2.生成一个简单的插件项目jenkins.archetypes:hello-world-plugin

查看模板list, mvn archetype:generate ​ 在结果搜索jenkins 相关的模板,选用io.jenkins.archetypes:hello-world-plugin

cd D:\jenkins_plugin & mvn archetype:generate -Dfilter=io.jenkins.archetypes:hello-world-plugin

中间需要输入一些自定义信息:groupid:com.testchina.jenkins、artifactid: hello

命令执行完之后 cd hello , mvn package

3.编译

mvn install,这一步build成功后,在./target 下会有一个hello.hpi ,可以在jenkins 里插件管理通过上传的方式安装

4.信息查看

在插件管理-已安装中,双击已安装插件右侧的带下划线的版本号链接,可以看到此插件的详细信息:

Name
Maven ID
License
TODO Plugin
io.jenkins.plugins:hello:1.0MIT License


后面将项目转到eclipse 中展开时,再关注这些信息的哪些文件中设置。


在eclipse 中修改plugin:

1.转成eclipse项目

cd hello  &  mvn eclipse:eclipse

2.在eclipse 中导入

import-maven-exist project 

3.目录结构

 整理中


 

 

 

Pre: jenkins 构建脚本标记为failure

Next: Window Jenkins 搭建

1021
Sign in to leave a comment.
No Leanote account? Sign up now.
0 comments
Table of content