Writing your own custom plugin

Generate plugin skeleton and test the HelloWorldBuilder project.

  1. 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
    You’ll be prompted to enter the groupId and artifactId, specify 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)
    You should see the page below. Click the link and that’ll take you to Jenkins home page
    Jenkins homepage link
  7. Click ‘Manage Jenkins’ > Configure System. Scroll down near the bottom of the page and you should see the Hello World Builder section
    Jenkins homepage link
  8. Navigate back to Jenkins home page and click New Item
  9. Give the project any name, select Freestyle Project, click OK.
  10. Scroll down to the Build section and click ‘Add build step’ > Say hello world
  11. Enter a name (i.e. TestName), save the project, then run a build (‘Build Now’)
  12. Click on the latest build under ‘Build History’ > Console Output.
    Jenkins homepage link
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s