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:
|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:
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
|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.