How to Create a Plugin for Jenkins

1) Create a build step:

import hudson.Extension;
import hudson.Launcher;
import hudson.model.BuildListener;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;

public final class SampleBuilder extends Builder {

  public static final class SampleBuilderDescriptor extends BuildStepDescriptor<Builder> {

    public String getDisplayName() {
      return "Sample Builder";

    public boolean isApplicable(@SuppressWarnings("rawtypes") final Class<? extends AbstractProject> jobType) {
      return true;


  public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) {
    return false;


2) Build the plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
  <name>Sample Plugin</name>

3) Install the plugin as described here.

4) Use the plugin in your jobs.

You can find more details here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s