二、利用maven创建插件D:Summer.XiaWorkspaceSoftwareapache-maven-3.6.0Repository org.jenkins-ci.tools jenkins truerepo.jenkins-ci.org http://repo.jenkins-ci.org/public/ repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ m.g.o-public
C:Summer.XiaWorkspaceGitee>java -version java version "1.8.0_211" Java(TM) SE Runtime Environment (build 1.8.0_211-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
C:Summer.XiaWorkspaceGitee>mvn hpi:create [INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-hpi-plugin:1.114-cloudbees-1:create (default-cli) @ standalone-pom --- ### 输入 groupId artifactId 相关信息 Enter the groupId of your plugin [org.jenkins-ci.plugins]: my-jenkins- plugin Enter the artifactId of your plugin (normally without '-plugin' suffix): hello-world [INFO] Defaulting package to group ID + artifact ID: hello-world.my-jenkins-plugin [WARNING] Package name contains invalid characters. Replacing it with 'helloworld.myjenkinsplugin' [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating Archetype: maven-hpi-plugin:1.114-cloudbees-1 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: basedir, Value: C:Summer.XiaWorkspaceGitee [INFO] Parameter: package, Value: helloworld.myjenkinsplugin [INFO] Parameter: groupId, Value: hello-world [INFO] Parameter: artifactId, Value: my-jenkins-plugin [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] Archetype created in dir: C:Summer.XiaWorkspaceGiteehello-world [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 18.983 s [INFO] Finished at: 2022-04-26T15:58:01+08:00 [INFO] ------------------------------------------------------------------------三、启动插件
启动前需要下载依赖jenkins依赖包,且保证http://repo.jenkins-ci.org可以访问,如访问不了请使用maven代理服务器。
通过链接访问jenkins: http://localhost:8080/jenkins
四、代码地址
https://gitee.com/xiaxinyu3_admin/hello-world-plugin.githttps://gitee.com/xiaxinyu3_admin/hello-world-plugin.git



