{"id":30366,"date":"2015-12-09T09:28:44","date_gmt":"2015-12-09T03:58:44","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=30366"},"modified":"2015-12-09T09:29:33","modified_gmt":"2015-12-09T03:59:33","slug":"springboot-applications-automation-using-jenkins","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/springboot-applications-automation-using-jenkins\/","title":{"rendered":"Springboot Applications automation using Jenkins"},"content":{"rendered":"<p>Building compressed files of Springboot application is a tedious task and its continuous deployment using Jenkins is even more so. To simplify the above predicament, a new Gradle plugin in Jenkins has been used. So, our objective in this blog \u00a0is to make use of the relation between Gradle and Springboot. Let us take it further.<\/p>\n<p>Primarily, the GRADLE tool for building a basic Springboot\u00a0application was used using Jenkins as a tool for continuous Integration. Firstly, the GRADLE PLUGIN in Jenkins was added. This was performed using the below flow of steps:<\/p>\n<p>[shell]Jenkins &gt;&gt; Manage Plugins &gt;&gt; Search for &quot;Gradle&quot; in the &quot;Available&quot; tab.&gt;&gt; Select &quot;Install without restart&quot;[\/shell]<\/p>\n<p>After the Plugin was successfully installed, a JOB was created and the GIT repository was defined as the SCM. Next, In the Build section the &#8220;Invoke Gradle\u00a0Script&#8221; option was selected.<\/p>\n<p>In this section, the various switches, tasks and also the &#8220;build.gradle&#8221;\u00a0file, in the case of \u00a0a separate build file, were defined.<\/p>\n<p>By defining a separate &#8220;build.gradle&#8221;, custom tasks can be added or the output compressed files such as jar or war are customized. A separate build.gradle file is used if one wants to use the same build file for multiple integrations in different Jenkins Jobs. Let&#8217;s say we want to overwrite a certain\u00a0parameter in the build file:<\/p>\n<p>[js]jar {<br \/>\n baseName = &#8216;Mynewapp&#8217;<br \/>\n version = &#8216;1.0&#8217;<br \/>\n}[\/js]<\/p>\n<p>If it was required to get the output jar file as test-1.0.jar , it could be passed \u00a0as an argument while the gradle\u00a0plugin in Jenkins was invoked.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30589\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/rsz_jenkins.jpg\" alt=\"rsz_jenkins\" width=\"730\" height=\"361\" \/><\/p>\n<p>By the usage of \u00a0the -P switch\u00a0i.e project properties, the parameter that is to be passed can be overwritten in place of the current parameter. Thus, the output jar file as test-1.0.jar was obtained.<\/p>\n<p>Save the Jenkins job and then build to get the desired results. The build console output was noted as:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-30634\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/jenk2.png\" alt=\"jenk2\" width=\"958\" height=\"590\" \/><\/p>\n<p>The build resulted in a .jar file as test-1.0.jar that one could run easily using java along with the various JAVA_OPTIONS through the command line.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building compressed files of Springboot application is a tedious task and its continuous deployment using Jenkins is even more so. To simplify the above predicament, a new Gradle plugin in Jenkins has been used. So, our objective in this blog \u00a0is to make use of the relation between Gradle and Springboot. Let us take it [&hellip;]<\/p>\n","protected":false},"author":178,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2},"categories":[1],"tags":[2878,2877,1511,1682,2072],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30366"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/178"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=30366"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30366\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=30366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=30366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=30366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}