The First Cry of Atom Today is the first day of the rest of my life.

Developing Jenkins plugin on Vagrant

Recently I investigate the scalability of Jenkins. In my idea, I want to make hot standby Jenkins server with NFS. So the plugins which enable us to do that are required. And for my study, I decided to develop on Vagrant and VirtualBox. It costs me very little because there is no need to get real server. So in this post, I will describe how to set up your jenkins plugin environment on your vagrant Ubuntu.

Start vagrant

My Vagrantfile is below. Before this, you should download precise64 box on vagrant site

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # Every Vagrant virtual environment requires a box to build off of. = "ubuntu"

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine. :forwarded_port, guest: 8080, host: 8080


Jenkins plugin server starts on port 8080. So you need to write guest port 8080. Host port can be written any number. And start vagrant.

$ vagrant up

Set up maven3

Jenkins plugins are build with Maven. In this time, Maven3 can build sample plugin easily, so I recommend that you download maven3.

$ sudo apt-get install maven

Write settings.xml

Write settings.xml as below.


    <!-- Give access to Jenkins plugins -->
        <activeByDefault>true</activeByDefault> <!-- change this to false, if you don't like to have it on per default -->


I failed to create my plugin in this time bacause of lack of JDK. Ubuntu 12.04 LTS doesn’t have JDK in own image. You have to install it.

$ sudo apt-get install default-jdk

Build plugin

Building plugin with maven command.

$ mvn install

And demonstrate your plugin.

$ mvn hpi:run

You can see Jenkins web UI on http://localhost:8080/jenkins unless maven command has not exit. So now, I can get multi Jenkins server for mutual mount on NFS. My Jenkins study has been continued.