Run jenkins-cli from Intellij


I need to start jenkins build job from Intellij, from terminal it works:

sudo java -jar jenkins-cli.jar -s http://localhost:8080/ build job-x/master -s -v

Intellij allows to create jar build configuration, but it doesn't allow to run jar files with administrator rights. So is there way to create build configuration in Intellij which runs jenkins-cli.jar?

Initial problem: need to run and debug jenkins pipeline script.

Comment actions Permalink

If you add jenkins-cli.jar to the module classpath, you can create Application run/debug configuration that will start the specified main class from this module dependencies.

Comment actions Permalink

Hm, I created run/debug configuration and run it, but have the same problem. Output:
at hudson.cli.Connection.readBoolean(
at hudson.cli.CLI.authenticate(
at hudson.cli.CLI._main(
at hudson.cli.CLI.main(

The same exception I get just running jenkins-cli.jar from terminal without sudo. It seems that jenkins-cli.jar need to do some IO operation that's why sudo is required. 

Comment actions Permalink

There is no way to run from IDEA with sudo except running IDEA itself with sudo.

Check the exception to see why it's needed, maybe you can workaround it by changing permissions of some files/folders, but this question is already outside of the IDE support scope.


Please sign in to leave a comment.