Jenkins plugin shows on Plugin page but does not show on configuration page

ぃ、小莉子 提交于 2021-01-27 06:00:56

问题


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.

enter image description here

Then I go to Configuration page and expect to see Hello World Builder section like the below image, but there is not. enter image description here

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. enter image description here


回答1:


What command did you use to generate the plugin skeleton?

FYI, from the tutorial above, mvn -cpu is deprecated.

To generate the plugin skeleton, use:

mvn hpi:create

or

mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create from the Jenkins Plugin tutorial

I'm going to include each step for what worked for me:

  1. mvn hpi:create, then enter groupId (press enter to use default: org.jenkins-ci.plugins) and artifactId (name of the plugin)
  2. cd new-plugin-name
  3. mvn eclipse:eclipse
  4. mvn package
  5. mvn hpi:run (default port is 8080, but you can set your own with Dport option (i.e. mvn hpi:run -Dport=9999, use this if port 8080 is in use - otherwise mvn hpi:run will fail)
  6. Open browser and enter URL "localhost:8080" (or 9999)
  7. You should the page below. Click the link and that'll take you to Jenkins home page enter image description here
  8. Click 'Manage Jenkins' > Configure System. Scroll down near the bottom of the page and you should see the Hello World Builder section enter image description here
  9. Go back to Jenkins home page and click New Item
  10. Give the project any name, select Freestyle Project, click OK.
  11. Scroll down to the Build section and click 'Add build step' > Say hello world
  12. Enter a name (i.e. TestName), save the project, then run a build ('Build Now')
  13. Click on the latest build under 'Build History' > Console Output.

enter image description here




回答2:


I had a same problem and solved it.
I am sure you are using eclipse as IDE and imported HelloWorldBuilder as a maven project.

In my case, I converted it to eclipse project after deleted and regenerated again. Please refer "Setting up a productive environment with you IDE" section of the following url and use this command.

mvn -DdownloadSources=true -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes -Declipse.workspace=/path/to/workspace eclipse:eclipse eclipse:add-maven-repo

https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial

If you launch the project after convert and rebuild it, the hello world builder section will be shown in your jenkins configuration menu.




回答3:


I recently had the same problem. Apparently currently (see date of this message) master of the hello world example is wrong. I needed to change

<artifactId>hello-world</artifactId>

to

<artifactId>hello_world</artifactId>

because some component in the middle doesn't accept "-". I think hpi:create will tell you that, unfortunately the debug log files don't. But the existing hello-world should already have those things correct.




回答4:


Even I faced same problem, I think reason is because I imported to eclipse as a maven project. I deleted folder and ran command

mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create

to create new project. Then ran mvn hpi:run and it showed up well.



来源:https://stackoverflow.com/questions/23002818/jenkins-plugin-shows-on-plugin-page-but-does-not-show-on-configuration-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!