5

We're using Jenkins, and are trying to automate deployments to our Artifactory server. We've downloaded the Artifactory plugin, and configured it, but it doesn't work. The list of repositories under "Resolution repository" and "Publishing repository" are blank.

Nothing appears in the log file to indicate there's any problems. I'm trying to call code from the Script Console, but I'm being hampered by the complete lack of documentation on creating a Jenkins plugin. There's a few tutorials, but they don't discuss details about how plugins get loaded by the system, or how I can get references to them to figure out what's going wrong.

How do I debug this thing?

Chris B.
  • 85,731
  • 25
  • 98
  • 139

3 Answers3

10

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>
Dan Berindei
  • 7,054
  • 3
  • 41
  • 48
KeepCalmAndCarryOn
  • 8,817
  • 2
  • 32
  • 47
  • Thanks. what do you mean by download? where to? I already have mvn – Dejell Nov 03 '14 at 14:02
  • What I meant to say is clone the github repo to a local directory with `git clone https://github.com/jenkinsci/artifactory-plugin` then run `mvn hpi:run` from the created directory – KeepCalmAndCarryOn Nov 03 '14 at 19:20
1

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.

elig
  • 439
  • 4
  • 4
-2

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

  • 3
    Please provide details on how to actually do what you propose. OP might not be familiar with either `mvnDebug` or how to attach the debugger to the IDE. – Max Leske Dec 09 '14 at 17:49