Skip to content
DSL to write Hudson's views with Ruby and ERB
Ruby Java
Latest commit baee22e Dec 13, 2010 @calavera add core taglibs


Hudson ERB plugin

Actually this is a Maven plugin to use to develop Hudson’s plugins and allows to write views with Ruby and ERB templates.

When we build a Hudson’s plugin with Maven it generates the jelly files that Hudson needs from our ERB templates.

WARNING: Right now it just includes a subset of the form views.


Add this to the pom file:



Add your ERB templates in the same place that you added your jelly files
with the same name but with extension jelly.erb, for instance if we have a
configuration form in src/main/resources/hudson/plugin/foo/config.jelly we
have to replace it with


We can replace this code:

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
         xmlns:t="/lib/hudson" xmlns:f="/lib/form" >
  <f:entry name="Verbose" description="Show Mirah AST generation">
    <f:checkbox name="verbose" checked="${instance.verbose}"/>

  <f:entry name="Script" description="Mirah script">
    <f:textarea name="command" value="${instance.command}"/>

with this one:

<% view do %>
  <% entry 'Verbose', :description => 'Show Mirah AST generation' do %>
    <%= checkbox 'verbose' %>
  <% end %>

  <% entry 'Script', :description => 'Mirah script' do %>
    <%= textarea 'command' %>
  <% end %>
<% end %>

We can see this same example working in the Mirah Interpreter plugin


In some cases perhaps we want to extend the dsl with our custom tags. We just need to create a file called ext.rb under the directory
src/main/resources/hudson_erb into our plugin and add the custom code to the module Hudson::View:

module Hudson
  module View
    def foo
      '<input type="foo"/>'

Then we can use that method in our views as we used any other:

  <% entry 'Foo', :description => 'My foo input' do %>
    <%= foo %>
  <% end %>
Something went wrong with that request. Please try again.