{"id":34421,"date":"2016-05-15T19:34:33","date_gmt":"2016-05-15T14:04:33","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=34421"},"modified":"2016-05-15T19:34:33","modified_gmt":"2016-05-15T14:04:33","slug":"auto-compilation-in-java-springboot-application","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/auto-compilation-in-java-springboot-application\/","title":{"rendered":"Auto compilation in java springboot application"},"content":{"rendered":"<p>To run springboot appllication there is a task <strong>&#8220;bootRun&#8221;<\/strong> which compile and run the application for one deployment lifecyle. This is good enough for the production, where auto compilation is not required.<\/p>\n<p>In the dev environment auto compilation is used to avoid recompilation. Also it is very much needed to speed up the development time for developers. <\/p>\n<p>For automatic compilation in springboot, there is a gradle <a href=\"http:\/\/docs.spring.io\/spring-boot\/docs\/current-SNAPSHOT\/reference\/htmlsingle\/#howto-reload-springloaded-gradle-and-intellij-idea\" title=\"plugin\" target=\"_blank\">plugin<\/a> which need to be added in build.gradle.<br \/>\n[java]<br \/>\nbuildscript {<br \/>\n    repositories {<br \/>\n        mavenCentral()<br \/>\n    }<br \/>\n    dependencies {<br \/>\n        classpath &#8216;org.springframework:springloaded:1.2.4.RELEASE&#8217;<br \/>\n    }<br \/>\n[\/java]<\/p>\n<p>You need to run the gradle application in the same way using <strong>&#8220;gradle bootRun&#8221;<\/strong> command. And Now you need to open a separate terminal instance same as in the project folder and run <strong>&#8220;gradle -t classes&#8221;<\/strong> command.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/TwoTerminalZoom.png\" alt=\"TwoTerminalZoom\" width=\"1280\" height=\"224\" class=\"alignnone size-full wp-image-34427\" \/><\/p>\n<p>This gradle <strong>&#8220;classes&#8221;<\/strong> task is continiously track the changed files in the current project directory.<br \/>\nAll the changed files are re-compiled in this case and the .class files are replaced with the previous ones, so that all the changes can reflect to the output automatically.<\/p>\n<p>Finally, we do not need to re compile the springboot application for any change in the source file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To run springboot appllication there is a task &#8220;bootRun&#8221; which compile and run the application for one deployment lifecyle. This is good enough for the production, where auto compilation is not required. In the dev environment auto compilation is used to avoid recompilation. Also it is very much needed to speed up the development time [&hellip;]<\/p>\n","protected":false},"author":203,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":15},"categories":[7,446,1994,1],"tags":[3320,3321,1511,4844,4841,3335,2072],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34421"}],"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\/203"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=34421"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34421\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=34421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=34421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=34421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}