Hot questions for Using Ubuntu in jenkins


I have a simple web project based on clojure, that just contains some markdown files in the resources folder. Previously I ran it with

cd my-project
lein ring server

and then I viewed the running project in the browser at http://localhost:port.

Now I wanted to integrate this process with jenkins so I

  • created a clojure project locally (in eclipse)
  • added leiningen support to my jenkins (add path to leiningen-standalone.jar in config)
  • added the build step 'build project using leiningen' in the jenkins job config
  • use jenkins to checkout from SCM and build the project

But then, Jenkins always complains about

> java -client -XX:+TieredCompilation
> -Xbootclasspath/a:/home/.lein/self-installs/clojure-1.8.0.jar 
> -Dfile.encoding=UTF-8 
> -Dmaven.wagon.http.ssl.easy=false 
> -Dleiningen.original.pwd=/var/lib/jenkins/jobs/my-project/workspace
> -cp /home/.lein/self-installs/clojure-1.8.0.jar clojure.main -m leiningen.core.main install 
> Error: Could not find or load main class clojure.main
> Build step 'Build project using leiningen' marked build as failure

I assumed, jenkins is missing the clojure.jar and it's not installing it to the .m2 repository, so I added it manually to


But that doesn't change anything for the build.

How to tell jenkins where to find the clojure.main? Any hints, what I am missing?


tl;dr - check permissions

When you setup leiningen+plugin for Jenkins make sure that the service account that jenkins is running under is the owner and has permissions to the leiningen-standalone.jar

In my case I installed leiningen at /var/lib/jenkins/.lein which was the default for the jenkins install and changed owner to jenkins:jenkins


I have an artifact hosted on maven. my setup on the local windows machine has been working perfectly; maven, gpg keys name it. upto now I can do 'mvn clean deploy' and my artifact gets signed and released very successfully. Enter continous integration with jenkins hosted on an ubuntu server. I successfully install gpg on ubuntu via putty. Since I already have versions of the artifact on maven signed with my gpg keys, I should continue using them right?So, I use winscp to transfer the gnupg folder and all its contents to ubuntu. Indeed when I run gpg --list-keys, I can see my key information (I only have one key configured). I am thinking, this, is a sign that my configuration on ubuntu is successful. According to an answer to this question I should take that there are no keys configured on ubuntu. So why would gpg --list-keys work?? When jenkins is trying to deploy the artifact, the "sign" goal fails and maven-gpg-plugin reports this:

gpg: no default secret key: secret key not available
gpg: signing failed: secret key not available

and the build fails, how can I resolve this issue?


I have found the solution. The only thing I was missing was the settings.xml file for my particular maven project. I had to find out where maven looks for this file from while building my project (usin mvn -X). Somehow Ubuntu did not create it, so I had to create one for myself and put in the relevant gpg properties. After this, everything worked like a breeze.