{"id":2450,"date":"2017-07-18T14:31:15","date_gmt":"2017-07-18T14:31:15","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=2450"},"modified":"2017-07-18T14:54:14","modified_gmt":"2017-07-18T14:54:14","slug":"automating-build-in-eclipse","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/automating-build-in-eclipse\/","title":{"rendered":"Automating Build in Eclipse"},"content":{"rendered":"<p><strong>BuildDeploy.bat<\/strong><\/p>\n<pre>\r\n cscript \/nologo c:\\Utils\\stopjboss.vbs\r\n\r\n set JBOSS_DEPLOYMENT=c:\\jboss\\standalone\\deployments\r\n set DEVELOPMENT_HOME=c:\\projectName\r\n set BRANCH=BranchName\\ReleaseNo\r\n \r\n del \/q %JBOSS_DEPLOYMENT%\\*.*\r\n cd %DEVELOPMENT_HOME%\\%BRANCH%\r\n \r\n call mvn clean\r\n call mvn install -o\r\n \r\n IF EXISTS  %DEVELOPMENT_HOME%\\%BRANCH%\\SpringMVC.war (\r\n  goto :startServer\r\n ) else (\r\n  echo Build Failed\r\n )\r\n\r\n exit \/b\r\n\r\n:startServer\r\n copy %DEVELOPMENT_HOME%\\%BRANCH%\\SpringMVC.war %JBOSS_DEPLOYMENT%\r\n cscript \/nologo c:\\Utils\\startjboss.vbs\r\ngoto :eof\r\n<\/pre>\n<p><strong>startjboss.vbs<\/strong><\/p>\n<pre>\r\n Set WshShell = WScript.CreateObject(\"WScript.Shell\")\r\n activateServer(\"Server\")\r\n WshShell.SendKeys \"%{d}\"\r\n\r\n Function activateServer(windowName)\r\n   WshShell.SendKeys \"^{3}\"\r\n   WScript.Sleep 500\r\n   WshShell.SendKeys windowName\r\n   WScript.Sleep 500\r\n   WshShell.SendKeys \"{ENTER}\"\r\n End Function\r\n<\/pre>\n<p><strong>stopjboss.vbs<\/strong><\/p>\n<pre>\r\n Set WshShell = WScript.CreateObject(\"WScript.Shell\")\r\n activateServer(\"Server\")\r\n WshShell.SendKeys \"%{s}\"\r\n WScript.Sleep 5000\r\n<\/pre>\n<p><strong>How it Works<\/strong><\/p>\n<ul>\n<li>We are using a VBScript to Start and Stop server by Sending Key Strokes to Eclipse(Shortcut Keys)<\/li>\n<li>The mvn clean and mvn install is done in 2 different steps to make sure that clean of the war files happen before the new file is created since executing clean and install in single shot happened to give inconsistent results<\/li>\n<li>Once the build is done we are checking whether the war file is created or we are assuming the build failed and we are not starting the server <\/li>\n<li>The builddeploy.bat should be configured in External Tools Configuration<\/li>\n<li>Workdirectory is the one which has pom.xml of the project<\/li>\n<li>Assign a shortcut key to Run Last Run Build Configuration<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/codethataint.com\/blog\/wp-content\/uploads\/2017\/07\/ExternalToolsConfiguration.png\" alt=\"\" height=\"729\" width=\"654\"\/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>BuildDeploy.bat cscript \/nologo c:\\Utils\\stopjboss.vbs set JBOSS_DEPLOYMENT=c:\\jboss\\standalone\\deployments set DEVELOPMENT_HOME=c:\\projectName set BRANCH=BranchName\\ReleaseNo del \/q %JBOSS_DEPLOYMENT%\\*.* cd %DEVELOPMENT_HOME%\\%BRANCH% call mvn clean call mvn install -o IF EXISTS %DEVELOPMENT_HOME%\\%BRANCH%\\SpringMVC.war ( goto :startServer ) else ( echo Build Failed ) exit \/b :startServer copy %DEVELOPMENT_HOME%\\%BRANCH%\\SpringMVC.war %JBOSS_DEPLOYMENT% cscript \/nologo c:\\Utils\\startjboss.vbs goto :eof startjboss.vbs Set WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;) activateServer(&#8220;Server&#8221;) WshShell.SendKeys &#8220;%{d}&#8221; Function&hellip; <a href=\"https:\/\/codethataint.com\/blog\/automating-build-in-eclipse\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[],"class_list":["post-2450","post","type-post","status-publish","format-standard","hentry","category-windows"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=2450"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2450\/revisions"}],"predecessor-version":[{"id":2456,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/2450\/revisions\/2456"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=2450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=2450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=2450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}