Step-by-Step Guide to Developing a Jenkins Plugin with FireLine
This tutorial walks readers through setting up the development environment, generating a Jenkins plugin skeleton with Maven, understanding the project structure and Jelly view files, writing the plugin code, debugging, and finally packaging and deploying the custom plugin to a Jenkins server.
The article introduces Jenkins plugin development, noting that many resources only cover basic Jenkins usage and that this guide will demonstrate creating a custom plugin using the FireLine example.
It lists the required environment: Maven 3, JDK 6+, and an IDE such as Eclipse.
To generate a plugin skeleton, run the Maven command mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create , providing the groupId and artifactId when prompted; this creates a FireLinePlugin directory with a basic plugin template.
The generated project follows a standard structure: src/main/java for Java source, src/main/resources for Jelly/Groovy view files, and src/main/webapp for static resources.
Jenkins uses Jelly for UI rendering; configuration files such as config.jelly and global.jelly define the plugin’s job configuration and global settings, respectively.
If Eclipse lacks the Maven plugin, the command mvn eclipse:eclipse converts the project into an Eclipse project; otherwise, the Maven project can be imported directly.
The core plugin class extends Builder and uses @DataBoundConstructor to map constructor parameters to Jelly fields. The perform() method receives build , workspace , launcher , and listener objects to execute the plugin’s logic.
An inner DescriptorImpl class annotated with @Extension provides the display name and form validation methods such as doCheckName for parameter checking.
For debugging, set JVM options with set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n and run mvn hpi:run , then access http://localhost:8080/Jenkins to test the plugin.
To package the plugin, execute mvn package , which produces a firelineplugin.hpi file in the target directory. Install the plugin by copying it to $JENKINS_HOME/plugins and restarting Jenkins, or upload it via the Jenkins “Manage Plugins → Advanced” UI.
360 Quality & Efficiency
360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.