user3181223
user3181223

Reputation:

How to install jenkins plugin by java program

I want to install jenkins plugin programmatically using java. can any one help me on this?

Upvotes: 1

Views: 385

Answers (1)

Peter Svensson
Peter Svensson

Reputation: 6173

You can access Jenkins remotely using the remote api . This can be used to install plugins as well, look at this gist and for example:

curl -X POST -d '<jenkins><install plugin="[email protected]" /></jenkins>' --header 'Content-Type: text/xml' http://localhost:8080/pluginManager/installNecessaryPlugins

will install the git plugin. So by using some HTTP library in Java you can do this from Java as well, posting HTTP requests to the remote api and installing plugins.

Upvotes: 3

Related Questions