Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug the Jenkins plugin

I have built a new "Hello World" plugin for Jenkins and I was able to upload it onto Jenkins and it works successfully. I am now trying to make change to the plugin and debug it on Jenkins.

Note: My Jenkins is deployed in my local tomcat, i build the hpi file and copy it to jenkins plugins folder, it works.

Now i want to ask how can i debug my plugin code? Suggestions with any IDE is welcome. I also have questions about:

  1. do i need to create a project for jenkins source in my IDE and develop my plugin base on it? Currently i only create a project for the plugin, build a hpi file and put it to Jenkins. I am not sure if this step is correct. Thanks in advance!
like image 442
huan feng Avatar asked Oct 29 '14 03:10

huan feng


People also ask

How do I debug Jenkins plugins?

Just add hpi:run in "Command line" filed and start Debug as usual. When the console says that your "Jenkins is fully up and running", open a browser and go to http://localhost:8080/jenkins/ and your code will stopped at break point (if any).

How do I see plugins in Jenkins?

From the web UI. The simplest and most common way of installing plugins is through the Manage Jenkins > Manage Plugins view, available to administrators of a Jenkins environment. Most plugins can be installed and used immediately by checking the box adjacent to the plugin and clicking Install without restart.


1 Answers

I imagine you ran

mvn package

to create your package

To debug you can do

mvnDebug hpi:run

and this will copy all the dependencies down (rather than in your jenkins install) and run it in place

If you are using an IDE then this can be done from within it.

More help can be found in the plugin tutorial

like image 114
KeepCalmAndCarryOn Avatar answered Sep 28 '22 18:09

KeepCalmAndCarryOn