{"id":373,"date":"2016-02-09T07:45:00","date_gmt":"2016-02-09T07:45:00","guid":{"rendered":"https:\/\/opstree.com\/blog\/\/2016\/02\/09\/jgit-flow-maven-plugin-to-release-java-application\/"},"modified":"2019-07-03T13:25:55","modified_gmt":"2019-07-03T13:25:55","slug":"jgit-flow-maven-plugin-to-release-java-application","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/2016\/02\/09\/jgit-flow-maven-plugin-to-release-java-application\/","title":{"rendered":"jgit-flow maven plugin to Release Java Application"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align:left;\">\n<h3 style=\"text-align:left;\">Introduction<\/h3>\n<div style=\"text-align:justify;\">As a DevOps I need a smooth way to release the java application, so I compared two maven plugin that are used to release the java application and in the end I found that Jgit-flow plugin is far better than maven-release plugin on the basis of following points:<\/div>\n<div style=\"text-align:justify;\"><\/div>\n<ul style=\"text-align:justify;\">\n<li>Maven-release plugin creates .backup and release.properties files to your working directory which can be committed mistakenly, when they should not be. jgit-flow maven plugin doesn&#8217;t create these files or any other file in your working directory.<\/li>\n<li>Maven-release plugin create two tags.<\/li>\n<li>Maven-release plugin does a build in the prepare goal and a build in the perform goal causing tests to run 2 times but jgit-flow maven plugin builds project once so tests run only once.<\/li>\n<li>If something goes wrong during the maven plugin execution, It become very tough to roll it back, on the other hand jgit-flow maven plugin makes all changes into the branch and if you want to roll back just delete that branch.<\/li>\n<li>jgit-flow maven plugin doesn&#8217;t run site-deploy<\/li>\n<li>jgit-flow maven plugin provides option to turn on\/off maven deployment<\/li>\n<li>jgit-flow maven plugin provides option to turn on\/off remote pushes\/tagging<\/li>\n<li>jgit-flow maven plugin keeps the master branch always at latest release version.<\/li>\n<\/ul>\n<div style=\"text-align:justify;\">Now let&#8217;s see how to integrate Jgit-flow maven plugin and use it<\/div>\n<h3 style=\"text-align:justify;\">How to use Jgit-flow maven Plugin for Release<\/h3>\n<div style=\"text-align:justify;\">Follow the flowing steps<\/div>\n<div style=\"text-align:justify;\">\n<ol>\n<li style=\"list-style-type:none;\">\n<ol>\n<li>Add the following lines in your pom.xml for source code management access\n<pre style=\"background-color:#eeeeee;border:1px dashed #999999;color:black;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;font-size:12px;line-height:14px;overflow:auto;padding:5px;width:100%;\"><code style=\"color:black;word-wrap:normal;\">\n<\/code> \u00a0 scm:git:\n\u00a0 scm:git:git:<\/pre>\n<\/li>\n<li>Add these line to resolve the Jgit-flow maven plugin and put the other option that will be required during the build\n<pre style=\"background-color:#eeeeee;border:1px dashed #999999;color:black;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;font-size:12px;line-height:14px;overflow:auto;padding:5px;width:100%;\"><code style=\"color:black;word-wrap:normal;\">com.atlassian.maven.plugins\nmaven-jgitflow-plugin\n1.0-m4.3\n\u00a0 \u00a0 \u00a0 \u00a0 \ntrue\nfalse\ntrue\ntrue\ntrue\ntrue\ntrue\ntrue\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \nmaster-test\ndeploy-test       <\/code><\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>Above code snippet will perform following steps:<\/p>\n<ol>\n<li style=\"list-style-type:none;\">\n<ul>\n<li>Maven will resolve the jgitflow plug-in dependency<\/li>\n<li>In the <b>configuration<\/b> section, we describe how jgit-flow plug-in will behave.<\/li>\n<li><b>pushRelease<\/b> XML tag to enable and disable jgit-flow from releasing the intermediate branches into the git or not.<\/li>\n<li><b>keepBranch<\/b> XML tag to enable and disable the plug-in for keep the intermediate branch or not.<\/li>\n<li><b>noTag<\/b> XMl tag to enable and disable the plug-in to create the that tag in git.<\/li>\n<li><b>allowUntracked<\/b> XML tag to whether allow untracked file during the checking.<\/li>\n<li><b>flowInitContext<\/b> XML tag is used to override the default and branch name of the jgit-flow plug-in<\/li>\n<li>In above code snippet, there is only two branches, master from where that code will be pulled and a intermediate branch that will be used by the jgit-flow plug-in. as I have discussed that jgit-flow plug-in uses the branches to keep it records. so development branch will be created by the plug-in that resides in the local not remotely, to track the release version etc.<\/li>\n<\/ul>\n<\/li>\n<li>To put your releases into the repository manager add these lines\n<pre style=\"background-color:#eeeeee;border:1px dashed #999999;color:black;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;font-size:12px;line-height:14px;overflow:auto;padding:5px;width:100%;\"><code style=\"color:black;word-wrap:normal;\"><code>&lt;distributionManagement&gt;\n\u00a0 &lt;repository&gt;\n\u00a0 \u00a0 &lt;id&gt;&lt;auth id&gt;&lt;\/id&gt;\n\u00a0 \u00a0 &lt;url&gt;&lt;repo url of repository managers&gt;&lt;\/url&gt;\n\u00a0 &lt;\/repository&gt;\n\u00a0 &lt;snapshotRepository&gt;\n\u00a0 \u00a0 &lt;id&gt;&lt;auth id&gt;&lt;\/id&gt;\n\u00a0 \u00a0 &lt;url&gt;&lt;repo url of repository managers&gt;&lt;\/url&gt;\n\u00a0 &lt;\/snapshotRepository&gt;\n&lt;\/distributionManagement&gt;<\/code><\/code><\/pre>\n<\/li>\n<li>Put the following lines into your m2\/settings.xml with your repository manager credentials\n<pre style=\"background-color:#eeeeee;border:1px dashed #999999;color:black;font-family:Andale Mono, Lucida Console, Monaco, fixed, monospace;font-size:12px;line-height:14px;overflow:auto;padding:5px;width:100%;\"><code>&lt;settings&gt;\n\u00a0 &lt;servers&gt;\n\u00a0 \u00a0 &lt;server&gt;\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;id&gt;&lt;PUT THE ID OF THE REPOSITORY OR SNAPSHOTS ID HERE&gt;&lt;\/id&gt;\n\u00a0 \u00a0 \u00a0  &lt;username&gt;&lt;USERNAME&gt;&lt;\/username&gt;\n\u00a0 \u00a0 \u00a0  &lt;password&gt;&lt;PASSWORD&gt;&lt;\/password&gt;\n\u00a0 \u00a0 &lt;\/server&gt;\n\u00a0 &lt;\/servers&gt;\n&lt;\/settings&gt;<\/code><\/pre>\n<\/li>\n<\/ol>\n<div>\n<h3 style=\"text-align:left;\">Start Release jgit-flow maven plugin command<\/h3>\n<div>To start the new release execute <a href=\"https:\/\/bitbucket.org\/atlassian\/jgit-flow\/wiki\/goals\/release-start\" target=\"_blank\" rel=\"noopener\">jgitflow:release-start<\/a>.<\/p>\n<p><span style=\"color:inherit;font-size:23px;font-weight:900;text-align:left;\">Finish Release jgit-flow maven plugin \u00a0command<\/span><\/div>\n<div>To finish new release, execute mvn <a href=\"https:\/\/bitbucket.org\/atlassian\/jgit-flow\/wiki\/goals\/release-finish\" target=\"_blank\" rel=\"noopener\">jgitflow:release-finish<\/a>.<span style=\"font-size:inherit;\"><br \/>\nFor a example I have created a repository in github.com. for testing and two branch master-test and deploy-test. It is assumed that you have configured maven and git your system.<\/span><\/p>\n<p>In the deploy-test branch run following command<br \/>\n$ mvn clean -Dmaven.test.skip=true install jgitflow:release-start<br \/>\n<a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/4a90f-screenshot2bfrom2b2016-02-082b15253a10253a07.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/4a90f-screenshot2bfrom2b2016-02-082b15253a10253a07.png?w=300\" width=\"640\" height=\"20\" border=\"0\" \/><\/a><\/p>\n<p>This command will take input from you for release version and create a release branch with release\/. then it will push this release branch into github repository for temporarily because we are not saving the intermediate branched<\/p>\n<div class=\"separator\" style=\"clear:both;text-align:center;\"><a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/db5e1-screenshot2bfrom2b2016-02-082b13253a07253a30.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/db5e1-screenshot2bfrom2b2016-02-082b13253a07253a30.png?w=300\" width=\"640\" height=\"82\" border=\"0\" \/><\/a><\/div>\n<div class=\"separator\" style=\"clear:both;text-align:center;\"><a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/d1486-screenshot2bfrom2b2016-02-082b13253a09253a10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/d1486-screenshot2bfrom2b2016-02-082b13253a09253a10.png?w=300\" width=\"640\" height=\"266\" border=\"0\" \/><\/a><\/div>\n<p>Now At the end run this command<br \/>\n$ mvn -Dmaven.test.skip=true jgitflow:release-finish<br \/>\nafter finishing this command it will delete release\/ from local and remote.<\/p>\n<div class=\"separator\" style=\"clear:both;text-align:center;\"><a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/a3d4e-screenshot2bfrom2b2016-02-082b13253a15253a53.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/a3d4e-screenshot2bfrom2b2016-02-082b13253a15253a53.png?w=300\" width=\"640\" height=\"49\" border=\"0\" \/><\/a><\/div>\n<div class=\"separator\" style=\"clear:both;text-align:center;\"><a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/7881f-aaa.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/7881f-aaa.png?w=300\" width=\"640\" height=\"116\" border=\"0\" \/><\/a><\/div>\n<p>Now you can check the changes in pom file by jgitflow. in the above snapshot, it is master-test branch, you can see in the tag it has removed the snapshot and also increased the version.\u00a0 It hold the current version of the application.<\/p>\n<p>And in the deploy-test branch it show you new branch on which developers are working on<\/p>\n<div class=\"separator\" style=\"clear:both;text-align:center;\"><a style=\"clear:left;float:left;margin-bottom:1em;margin-right:1em;\" href=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/9c2c9-bcc.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2016\/02\/9c2c9-bcc.png?w=300\" width=\"640\" height=\"116\" border=\"0\" \/><\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction As a DevOps I need a smooth way to release the java application, so I compared two maven plugin that are used to release the java application and in the end I found that Jgit-flow plugin is far better than maven-release plugin on the basis of following points: Maven-release plugin creates .backup and release.properties &hellip; <a href=\"https:\/\/opstree.com\/blog\/2016\/02\/09\/jgit-flow-maven-plugin-to-release-java-application\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;jgit-flow maven plugin to Release Java Application&#8221;<\/span><\/a><\/p>\n","protected":false},"author":150552946,"featured_media":29900,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[30871489,768739308,768739295,180193575,47862],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/11\/DevSecOps-1.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-61","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/373"}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/150552946"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=373"}],"version-history":[{"count":4,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/373\/revisions"}],"predecessor-version":[{"id":686,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/373\/revisions\/686"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29900"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}