Jump to: navigation, search

Releasing Hudson Plugin

Maven central is the place where ultimately all maven artifacts gets published. Hudson plugins should end up here (if the groupid of your plugin is org.hudsonci.plugins)

However, directly publishing to maven central is not allowed. Every one publishes to a intermediate Nexus repository where they have account and access. Then the artifacts from that repository get pushed to maven central. Hudson project uses OSS Nexus repository.

Publishing your plugin to OSS Nexus repository

To publish to Nexus OSS Repository you need an account.

  1. Signup for a Sonatype JIRA account. The Sonatype JIRA credentials will be same as Nexus OSS account
  2. Create a JIRA issue to get permission to publish to OSS Nexus repository

Read the document Sonatype OSS Maven Repository Usage Guide for more details

Setting up PGP Key

This step is one time setup. In order to publish to OSS Nexus repository, you need a valid PGP key published to a key server. Read this article on how to set up your PGP key. If you set up a Pass Phrase for your PGP key, you could add it to your settings file (~/.m2/settings.xml) as shown below.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
..
..
<profiles>
    <profile>
      <id>development</id>
      <properties>
        <gpg.passphrase>{Your PGP key Pass Phrase}</gpg.passphrase>
       </properties>
    </profile>
</profiles>

<activeProfiles>
  <activeProfile>development</activeProfile>
</activeProfiles>
..
..
</settings>

If you don't want to put it in settings.xml file, other option is to pass it to the maven release:perform command using -Dgpg.passphrase=<pass-phrase>

Specifying your OSS Nexus repository credentials

This is also a one time setup. For pushing your plugin to OSS Nexus repository, maven need to know your credentials. You could permanently add it the settings file (~/.m2/settings.xml).

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  ..
  ..
  <servers>
    <server>
      <id>sonatype-nexus-snapshots</id>
      <username>your-sonatype-jira-id</username>
      <password>your-sonatype-jira-pwd</password>
    </server>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>your-sonatype-jira-id</username>
      <password>your-sonatype-jira-pwd</password>
    </server>
  </servers>
  ..
  ..

 </settings>

If you don't want to put it in settings.xml file, other option is to pass it to the maven release:perform command using -Dusername and -Dpasseord Adding the Nexus OSS repository information to your POM

Adding the Nexus OSS release repository information in your POM is easy. Just include the following in your plugin POM where the distribution management information is specified

  <parent>
    <groupId>org.jvnet.hudson.plugins</groupId>
    <artifactId>hudson-plugin-parent</artifactId>
    <!-- The version of hudson platform  -->
    <version>1.398</version>
  </parent

Note: You need version 1.398 or later to deploy to OSS Nexus repository. If you are using older version then you should add the following to your plugin

  <distributionManagement>
         <snapshotRepository>
             <id>sonatype-nexus-snapshots</id>
             <name>Sonatype Nexus Snapshots</name>
             <url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
         </snapshotRepository>
         <repository>
             <id>sonatype-nexus-staging</id>
             <name>Nexus Release Repository</name>
             <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
         </repository>
  </distributionManagement>

Specifying SCM information

Specify the SCM information where your plugin is hosted. You need this for maven-release-plugin to create the release tag in your SCM.

<scm>
    <connection>scm:git:git://github.com/hudson/hudson.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/hudson/hudson.git</developerConnection>
    <url>https://github.com/hudson/hudson</url>
</scm>

Specifying the sections where your plugin should appear in the update center

Update center displays the plugins under certain sections. In order to specify under which sections your plugin should appear add the property <hudsonTags> to your pom.xml. For example:

   <groupId> .. </groupId>
   <artifactId> .. </artifactId>
   ..
   <properties>
       <hudsonTags>scm,builder</hudsonTags>
   </properties>
   ..

Staging your release

Stage the release of your plugin using maven commands

mvn release:clean
mvn release:prepare -DpushChanges=false

The two steps above prepare your plugin for releasing. It creates a release tag as specified by you in the release prepare step.

mvn release:perform -DlocalCheckout=true

Maven will checkout the release tag locally, then build and deploy it into Nexus staging repository.

In the above case, maven modifies POM file and creates the release tag etc, but does not push to the origin, but commits locally and checkouts locally. Once the release is done successfully, you have to manually push the commits and the tag created during the release.

Releasing to Maven Central

  • Next Step is to release it.
  • Login in to Nexus OSS . Click on the Staging Repositories at the left had side bar. Select the checkbox corresponding to your plugin. Click close to stage your plugin
  • Verify your plugin artifacts that appear at the OSS Nexus staging area
  • Once the staging is satisfactory, click on the release button to push from OSS Nexus staging area to Maven Central


Once your plugin is released it need to be uploaded to the Plugin Central for it to be included in the Hudson update center. Currently Hudson team monitors the release and uploads the plugin. In the future the plugin developers will get an account in the Plugin Central, so that they can manage their own plugins.

Announcing your Plugin and the Wiki page

To ensure that your plugin details are available on the Hudson wiki you need to do the following. If you are unable to create a page, request wiki-edit permission via the Dev mailing list

  1. Create a stub page on the Hudson wiki (go here)
  2. Add the hudson-plugin-info and excerpt macros to the page - these pull information from the Update Center JSON file:
    {hudson-plugin-info:<yourpluginID>{color:#ff6600}}a quick description of your plugin that will be included in the 'plugins by topic' wiki page too
  3. Add labels to your page to denote the plugin's tier: tier1-plugin, tier2-plugin, tier3-hudson-plugin (if the plugin is for Hudson only), tier3-compat-plugin (if compatible with both Hudson and Jenkins), tier3-installtest-plugin (if the plugin has been tested for install on Hudson, but not for full working compatibility) to denote the topic it will be presented under in this page
  4. Add description/configuration information to the wiki or point to the external source of such documentation

Finally, announce your plugin on the Hudson Developer list. If your plugin is hosted outside of Hudson be sure to include that in the announcement so that it can included in the Update Center JSON script.

Want More Help?

In his blog Henrik Lynggard Hansen has explain his experience with releasing the Project Health Report plugin. This four part blog is a very useful resource.

  1. Getting access
  2. Settings.xml and the pom.xml
  3. The Release process
  4. Post release work