问题
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.
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.
回答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:
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.
回答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