Monday, 21 November 2011

Life is too short to waste time uploading a patch or Maven Patch Tracker plugin

Life is too short and you don't want to waste time contributing to a project (creating a patch, a entry in the jira issue tracker then upload the patch).
So the Maven Patch Tracker plugin is for you !



You will be able with a maven plugin to do all of this in one command line !
Without any configuration you have to write :

mvn patch-tracker:create
-Dpatch.summary="foo summary"
-Dpatch.serverUrl=http://localhost:8080/browse/MNG -B
-Dpatch.user=uid -Dpatch.password=pwd


If you find that boring or too long no problem, there is a solution for that (yes good developer are lasy developers they use tool to automate tasks :-) ).
So configure you pom, with the issue tracker id

<issueManagement>
<system>jira</system>
<url>http://host:ip/browse/projectKey</url>
</issueManagement>


Add a server entry in you settings.xml


<server>
<id>jira-maven</id>
<username>olamy</username>
<password>very complicated password for paranoiac security folks</password>
</server>


Reference this jira server in your pom:


<properties>
....
<patch.tracker.serverId>jira-maven</patch.tracker.serverId>
....
</properties>


Et voilà, just run and save fingers:

mvn patch-tracker:create -Dpatch.summary="foo summary" -B


NOTE: without -B the plugin will use a prompt mode to ask you confirmation on the values

An other mojo called update can add/update an issue with an other patch:

mvn patch-tracker:update -Dpatch.description="update of the issue with an other patch" -Dpatch.patchId=MNG-5203 -B

This command will update the issue MNG-5203 with an other patch.

NOTE: currently only jira is supported

The plugin will use the configured scm client configured tru your scm url to generate the patch/diff file.
So your project is configured with svn but for some reasons you use git svn.
No problem add the parameter: -Dscm.providerType=git

Other improvement I think: load the patch to review board.

Something else ?
Ideas and patches are welcome :-)

You can test it using the snapshot repo: https://repository.apache.org/content/groups/snapshots-group/ or build it yourself: http://svn.apache.org/repos/asf/maven/sandbox/trunk/plugins/maven-patch-tracker-plugin/

Have Fun and good hacking!

7 comments:

ehsavoie said...

When the ASF will support GIT we may hope for a pull request maven plugin ? ;)

olamy said...

@emmanuel git doesn't mean pull request ! the pull request feature is a feature made by the *private* company github !

Thomas Broyer said...

FYI, Gitorious has "merge requests" which are not that different from GitHub's pull requests.

Arnaud said...

Agree with olamy, but also without having github and its pull request system, git has a great patch management system using emails. Something that ASF should love (tracability ...)

olamy said...

@Arnaud I prefer tracability in jira issue personnally.
More easy to search issues attached to a release rather than searching in TON of emails.
See the number of scm emails you receive from jenkins github project. Perso I don't have time to read so much...

ehsavoie said...

You have a similar process in Atlassian Bitbucket.
And talking about *private* company, sorry but Atlassian is also private ;o)
So integrating with github is as bad as integrating with Jira ;o)

olamy said...

@Emmanuel sure but there is a huge difference.
Atlassian give free license for open source so you can install your OWN instance on your OWN server(s).
Where github offer a service which you don't know how long it will be free and you don't have any control on where datas are stored. What about your confidential datas (yes open source project/foundation can have confidential datas)