Debugging a Jenkins plugin Debugging a Jenkins plugin jenkins jenkins

Debugging a Jenkins plugin


You can download the source for the plugin from its github location in jenkinsci

Then as this uses the maven jenkins plugin framework you can then do

mvn hpi:run

from the commandline which will download all the jenkins jars and additional jars you need documentation

This will give you a test jenkins install on port 8080 of localhost which you can then connect to, create jobs, install plugins and run jobs

I debug this with intellij. Point intellij at the POM file and it should load all the maven commands into the maven toolbox, from here you can debug the plugin by debugging the hpi:run command.

You can do a similar thing with eclipse or possibly use mvnDebug inplace of mvn and attach a remote debugger https://stackoverflow.com/a/2935475/1213907

If the plugin does not have reference the Jenkins Maven repository, you must add it yourself in pom.xml or in ~/.m2/settings.xml:

  <pluginRepositories>    <pluginRepository>      <id>repo.jenkins-ci.org</id>      <url>https://repo.jenkins-ci.org/public/</url>    </pluginRepository>  </pluginRepositories>


Regarding the Artifactory plugin, try saving the configuration and reload the job config page.The logic behind this is to avoid a list of repositories to long, some servers has up 100 local repostoies and this way, by entering credential, you can display a list of only relevant repositories. There is an open issue to have a refresh button so there will be no need to save the config prior to displaying the list.


Try to use mvnDebug and attach the debugger to your IDE.