Jenkins插件显示在“插件"页面上,但不显示在配置页面上 [英] Jenkins plugin shows on Plugin page but does not show on configuration page
问题描述
I am creating a hello world plugin for Jenkins by following Tutorial: Create a Jenkins Plugin to integrate Jenkins and Nexus Repository. After I followed the steps, I can run Jenkins and test the plugin.
它显示在已安装的插件"页面上.
It shows on Installed Plugin Page.
然后我转到配置"页面,希望看到下图所示的Hello World Builder
部分,但没有.
Then I go to Configuration page and expect to see Hello World Builder
section like the below image, but there is not.
我错过了哪些步骤?在将该插件显示在配置页面上之前,我需要做些什么吗?
What steps did I miss? Is there anything I have to do before having that plugin show up on the configuration page?
更新 这是项目布局,我还没有对其进行任何修改.
Update This is the project layout, I haven't modified anything on it yet.
推荐答案
您使用了什么命令来生成插件框架?
What command did you use to generate the plugin skeleton?
仅供参考,不建议使用上述教程中的mvn -cpu
.
FYI, from the tutorial above, mvn -cpu
is deprecated.
要生成插件框架,请使用:
To generate the plugin skeleton, use:
mvn hpi:create
或
mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create
插件指南
我将包括对我有用的每一步:
I'm going to include each step for what worked for me:
-
mvn hpi:create
,然后输入groupId(按Enter使用默认值: org.jenkins-ci.plugins )和artifactId(插件名称) -
cd new-plugin-name
-
mvn eclipse:eclipse
-
mvn package
-
mvn hpi:run
(默认端口为8080,但您可以使用Dport
选项设置自己的端口(即mvn hpi:run -Dport=9999
,如果正在使用端口8080,请使用此端口,否则mvn hpi:run
将会失败) - 打开浏览器并输入URL"localhost:8080"(或9999)
- 您应该在下面的页面.单击链接,您将带您到Jenkins主页
- 点击管理Jenkins">配置系统".向下滚动到页面底部附近,您应该看到Hello World Builder部分
- 返回Jenkins主页,然后单击新建项目"
- 为项目提供任何名称,选择"Freestyle Project",然后单击确定".
- 向下滚动到构建"部分,然后单击添加构建步骤">向世界问好
- 输入名称(即TestName),保存项目,然后运行构建(立即构建")
- 在构建历史记录">控制台输出下单击最新的构建.
mvn hpi:create
, then enter groupId (press enter to use default: org.jenkins-ci.plugins) and artifactId (name of the plugin)cd new-plugin-name
mvn eclipse:eclipse
mvn package
mvn hpi:run
(default port is 8080, but you can set your own withDport
option (i.e.mvn hpi:run -Dport=9999
, use this if port 8080 is in use - otherwisemvn hpi:run
will fail)- Open browser and enter URL "localhost:8080" (or 9999)
- You should the page below. Click the link and that'll take you to Jenkins home page
- Click 'Manage Jenkins' > Configure System. Scroll down near the bottom of the page and you should see the Hello World Builder section
- Go back to Jenkins home page and click New Item
- Give the project any name, select Freestyle Project, click OK.
- Scroll down to the Build section and click 'Add build step' > Say hello world
- Enter a name (i.e. TestName), save the project, then run a build ('Build Now')
- Click on the latest build under 'Build History' > Console Output.
这篇关于Jenkins插件显示在“插件"页面上,但不显示在配置页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!