Build and Run the Plugin

Table of Contents

The Maven HPI Plugin is used to build and package Jenkins plugins. It also provides a convenient way to run a Jenkins instance with your plugin:

mvn hpi:run
You may need to specify a port number for your plugin to use. You can specify a port like this
mvn hpi:run -Dport=5000
To learn more about Maven HPI Plugin and the goals it provides, see its documentation.

This will set up a Jenkins instance on http://localhost:8080/jenkins/. Wait for the following console output, then open a web browser and look at what the plugin does.

INFO: Jenkins is fully up and running
The Jenkins home directory used is the work/ directory in the plugin directory. This means that subsequent runs will keep their data.

Create a new freestyle project in Jenkins, and give it any name.

Then add the "Say hello world" build step. It will look like this:

Freestyle job configuration

Enter a name, save the project, and start a new build. Navigate to the build on the UI, and click Console Output to view the build log. It will contain a message written by the build step that was just configured:

Started by user anonymous
Building in workspace /Users/mrjenkins/demo/work/workspace/testjob
Hello, Jenkins! (1)
Finished: SUCCESS
1 The Greeting added by the build step

Let’s stop Jenkins by pressing Ctrl-C (or your system’s equivalent) in the terminal.

Next step: Extend the plugin.


Anything not working for you? Ask for help in chat or on the jenkinsci-dev mailing list.