Jenkin插件开发最新方式(mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin)
来源:互联网 发布:腾讯网络加速器独立版 编辑:程序博客网 时间:2024/06/06 15:44
一、环境依赖
1.1 JDK配置
JDK版本要求在1.6以上
E:\jenkinsplugin>java -versionjava version "1.8.0_91"Java(TM) SE Runtime Environment (build 1.8.0_91-b15)Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)
1.2 Maven配置
Maven官方要求版本在3以上
E:\jenkinsplugin>mvn -versionApache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T01:37:52+08:00)Maven home: D:\Atlassian\atlassian-plugin-sdk-6.2.14\apache-maven-3.2.1Java version: 1.8.0_91, vendor: Oracle CorporationJava home: C:\Program Files\Java\jdk1.8.0_91\jreDefault locale: zh_CN, platform encoding: GBKOS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
1.3 Maven环境配置
到用户目录的.m2下修改setting.xml文件,配置Jenkins库依赖,C:\Users\Administrator\.m2\settings.xml
<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <pluginGroups> <pluginGroup>org.jenkins-ci.tools</pluginGroup> </pluginGroups> <mirrors> <mirror> <id>repo.jenkins-ci.org</id> <url>https://repo.jenkins-ci.org/public/</url> <mirrorOf>m.g.o-public</mirrorOf> </mirror> </mirrors> <profiles> <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>https://repo.jenkins-ci.org/public/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>repo.jenkins-ci.org</id> <url>https://repo.jenkins-ci.org/public/</url> </pluginRepository> </pluginRepositories> </profile> </profiles></settings>
二、插件开发
2.1 创建
原命令:mvn hpi:create或者mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create
执行后错误信息如下:
E:\jenkinsplugin>mvn hpi:create[INFO] Scanning for projects...[INFO][INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1[INFO][INFO] ------------------------------------------------------------------------[INFO] Building Maven Stub Project (No POM) 1[INFO] ------------------------------------------------------------------------[INFO][INFO] --- maven-hpi-plugin:2.1:create (default-cli) @ standalone-pom ---[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.839 s[INFO] Finished at: 2017-10-27T15:48:34+08:00[INFO] Final Memory: 17M/222M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:2.1:create(default-cli) on project standalone-pom: Unimplemented![ERROR] hpi:create is obsolete. Instead use:[ERROR] ====[ERROR] mvn archetype:generate -Dfilter=io.jenkins.archetypes:[ERROR] ====[ERROR] -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin
E:\>mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin[INFO] Scanning for projects...[INFO][INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1[INFO][INFO] ------------------------------------------------------------------------[INFO] Building Maven Stub Project (No POM) 1[INFO] ------------------------------------------------------------------------[INFO][INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom>>>[INFO][INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom<<<[INFO][INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom---
执行过程中需要提交一些信息,1、选择archetype,提示列出了三种,这里选择一个空白的插件框架1
Choose archetype:1: remote -> io.jenkins.archetypes:empty-plugin (Skeleton of a Jenkins plugin with a POM and an empty source tree.)2: remote -> io.jenkins.archetypes:global-configuration-plugin (Skeleton of a Jenkins plugin with a POM and an example piece of global configuration.)3: remote -> io.jenkins.archetypes:hello-world-plugin (Skeleton of a Jenkins plugin with a POM and an example build step.)Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
2、选择版本,默认1.2Choose io.jenkins.archetypes:empty-plugin version:1: 1.02: 1.13: 1.2Choose a number: 3:
3、提供groupId,Define value for property 'groupId':XXX.XXX.XXX
4、提供ArtifactId,项目名称Define value for property 'artifactId':XXX
5、提供版本号,默认1.0-SNAPSHOTDefine value for property 'version' 1.0-SNAPSHOT:
6、提供应用包名,默认groupIdDefine value for property 'package' XXX.XXX.XXX: :
7、确认以上信息Confirm properties configuration:Y
创建成功[INFO] Project created from Archetype in dir: E:\jenkinsplugin\[INFO] --------------------------------------------------------[INFO] BUILD SUCCESS[INFO] --------------------------------------------------------[INFO] Total time: 18:57 min[INFO] Finished at: 2017-10-27T17:09:59+08:00[INFO] Final Memory: 15M/123M[INFO] --------------------------------------------------------
2.1 编译插件生成hpi文件
cd到XXX工程目录下,执行以下命令
mvn install 或者mvn package
执行完成如下
官方链接:https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial#Plugintutorial-CreatingaNewPlugin
[INFO] Skipping packaging of the test-jar[INFO] -----------------------------------------------------------[INFO] BUILD SUCCESS[INFO] -----------------------------------------------------------[INFO] Total time: 02:11 min[INFO] Finished at: 2017-10-27T17:14:20+08:00[INFO] Final Memory: 54M/749M[INFO] -----------------------------------------------------------
官方链接:https://wiki.jenkins.io/display/JENKINS/Plugin+tutorial#Plugintutorial-CreatingaNewPlugin
阅读全文
0 0
- Jenkin插件开发最新方式(mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin)
- mvn学习日记(mvn clean install mvn archetype:generate)
- mvn archetype:generate报错
- 解决mvn archetype:generate 速度缓慢问题
- idea maven mvn archetype:generate卡住问题
- maven自动创建项目:mvn archetype:generate
- idea maven mvn archetype:generate 速度缓慢问题
- Maven:解决mvn archetype:generate很慢的问题
- idea maven mvn archetype:generate 速度缓慢问题
- mvn archetype:generate 执行很慢的原因
- archetype:generate
- Maven插件之maven-archetype-plugin
- Jenkin 插件开发——build页面右侧创建页面&jenkin自身bug一例
- Jenkins的plugin开发
- Jenkins的plugin开发
- 【原创】使用mvn archetype插件自定义项目骨架模板
- 安装Maven,运行mvn archetype:generate后出现 ERROR: JAVA_HOME is set to an invalid directory.
- maven:使用mvn archetype:generate创建项目,停留在 "Generating project in Batch mode"
- 一个好用的分页函数
- C# Event/UnityEvent辨析
- 自然语言处理-中文分词方法总结
- 今日给我办公室的电脑安装了Oracle VM VirtualBox
- 前端页面实现报警器提示音效果
- Jenkin插件开发最新方式(mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin)
- React Native 滚动页面置顶
- 软件系统开发到哪里做
- React Native 自定义实现【Toast】提示框
- 将时间格式化成字符串共同函数暂存
- GPIO及中断API函数
- CentOS7 firewall设置
- linux 命令之 curl 指定ip访问对应的域名地址
- Unity(OpenGL)实现“阴阳师画符”、划线功能