Releasing a Jira Plugin with Maven release:perform

Introduction

As more projects become agile, the amount of releases (deployments) increases excessively. These releases require a lot of manual work that can be automated with Maven. The following article describes how to release Jira plugins using the command mvn release:prepare and mvn release:perform

Prerequisites

You need a svn command line client on your machine. Mac users are happy because their machine comes with one. Windows users have to download one. See http://subversion.apache.org/.

Configure your Maven

Add the following to code to your pom:

:
  <packaging>atlassian-plugin</packaging>
    <scm>
      <connection>scm:svn:https://k15t.jira.com/svn/TEST/trunk</connection>
    </scm>
  <dependencies>
  :

Build your Plugin
  1. Go to your project directory where the pom.xml is located. Execute the following command:
    mvn -Dusername=sebastian.lenk -Dpassword=xxx -DscmCommentPrefix="[TEST-1]MvnRelease" -Dgoals=package release:prepare release:perform
  2. Enter the requested information for release version, release tag and the new development version.
  3. If the build is successful you find in the target folder the jar file.

If the build fails you can roll it back with: mvn -DscmCommentPrefix="[TEST-1]MvnRelease" release:rollback

What maven did for you
  1. updates the version of your project by removing the -SNAPSHOT designation. For example, 1.2-SNAPSHOT will be updated to 1.2.
  2. tags the release in svn as projectname-1.2.
  3. creates the plugin jar in the target folder with the correct version number. For example 1.2
  4. again updates the version of your project to the next SNAPSHOT revision. To continue the example above, the project would now be at revision 1.3-SNAPSHOT.
  5. commits everything to svn.