{"id":1867,"date":"2017-01-12T06:54:57","date_gmt":"2017-01-12T06:54:57","guid":{"rendered":"http:\/\/www.msinterdev.org\/wp\/2017\/01\/12\/maven-%ed%94%84%eb%a1%9c%ec%a0%9d%ed%8a%b8-%eb%b9%8c%eb%93%9c-%eb%b0%8f-%eb%b0%b0%ed%8f%ac-%ed%86%b5%ed%95%a9-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8-%ec%98%88%ec%a0%9c\/"},"modified":"2017-01-12T06:54:57","modified_gmt":"2017-01-12T06:54:57","slug":"maven-%ed%94%84%eb%a1%9c%ec%a0%9d%ed%8a%b8-%eb%b9%8c%eb%93%9c-%eb%b0%8f-%eb%b0%b0%ed%8f%ac-%ed%86%b5%ed%95%a9-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8-%ec%98%88%ec%a0%9c","status":"publish","type":"post","link":"http:\/\/www.msinterdev.org\/wp\/2017\/01\/12\/maven-%ed%94%84%eb%a1%9c%ec%a0%9d%ed%8a%b8-%eb%b9%8c%eb%93%9c-%eb%b0%8f-%eb%b0%b0%ed%8f%ac-%ed%86%b5%ed%95%a9-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8-%ec%98%88%ec%a0%9c\/","title":{"rendered":"[maven] \ud504\ub85c\uc81d\ud2b8 \ube4c\ub4dc \ubc0f \ubc30\ud3ec \ud1b5\ud569 \uc2a4\ud06c\ub9bd\ud2b8 \uc608\uc81c"},"content":{"rendered":"<p>#!\/bin\/bash<\/p>\n<p>APPS_HOME=<span style=\"color: #ff0000;\"><strong>${base_dir_to_be_installted}<\/strong><\/span><br \/>INSTALL_DIR=&#8221;$APPS_HOME\/&#8221;`date +%Y%m%d-%H%M`<br \/>SOURCE_HOME=`pwd`<\/p>\n<p>synchronized(){<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nMake newest\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; set timeout 1<br \/>&nbsp;&nbsp;&nbsp; git reset &#8211;hard HEAD<br \/>&nbsp;&nbsp;&nbsp; git checkout master<\/p>\n<p>&nbsp;&nbsp;&nbsp; expect -c&#8221;<br \/>&nbsp;&nbsp;&nbsp; set timeout 4<br \/>&nbsp;&nbsp;&nbsp; spawn git pull &#8211;all<br \/>&nbsp;&nbsp;&nbsp; expect &#8216;Password: &#8216;<br \/>&nbsp;&nbsp;&nbsp; send <span style=\"color: #ff0000;\">${password}<\/span>\\r<br \/>&nbsp;&nbsp;&nbsp; expect eof&#8221;<br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>build() {<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nBuild Source\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; `set timeout 1`<br \/>&nbsp;&nbsp;&nbsp; profile=$2<br \/>&nbsp;&nbsp;&nbsp; if [ ! -n &#8220;$profile&#8221; ];&nbsp; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; profile=&#8221;stage&#8221;<br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;load [$profile] configuration&#8221;<br \/>&nbsp;&nbsp;&nbsp; mvn clean package -P&#8221;$profile&#8221;<br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>makeAppDir() {<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nCreate install directory\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; set timeout 1<br \/>&nbsp;&nbsp;&nbsp; currentDateTime=$INSTALL_DIR<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ ! -d $INSTALL_DIR ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir $INSTALL_DIR<br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>copy-bin(){<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nCopy binary file to install directory\\n#############&#8221;<br \/>&nbsp;&nbsp;&nbsp; set timeout 1<br \/>&nbsp;&nbsp;&nbsp; cd $SOURCE_HOME<br \/>&nbsp;&nbsp;&nbsp; cp -rf .\/target\/<span style=\"color: #ff0000;\"><strong>${built-jar-file}<\/strong><\/span> .\/target\/&#8230; .\/target\/&#8230; $INSTALL_DIR<br \/>&nbsp;&nbsp;&nbsp; cd $INSTALL_DIR<br \/>&nbsp;&nbsp;&nbsp; unzip -o <span style=\"color: #ff0000;\"><strong>${built-jar-file}<\/strong><\/span> -d <span style=\"color: #ff0000;\"><strong>${desired-loc-for unzip }&nbsp; ## unzip all <\/strong><\/span><span style=\"color: #ff0000;\"><strong>for modifing easy<\/strong><\/span><br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>relink(){<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nCreate Symbolic Link\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; set timeout 1<br \/>&nbsp;&nbsp;&nbsp; cd $APPS_HOME<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; #if [ -d &#8220;$APPS_HOME\/default&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rm -rf &#8220;$APPS_HOME\/default&#8221;<br \/>&nbsp;&nbsp;&nbsp; #fi<br \/>&nbsp;&nbsp;&nbsp; ln -s $INSTALL_DIR default<br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>killProcess(){<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nKill Process previous run\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; `set timeout 1`<br \/>&nbsp;&nbsp;&nbsp; processInfo=`ps -ef | grep java | grep <span style=\"color: #ff0000;\"><strong>${identified process name}<\/strong><\/span> `<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ ! -n &#8220;$processInfo&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -e &#8220;not found process&#8221;<br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ -n &#8220;$processInfo&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arrayInfo=(${processInfo})<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -e &#8220;kill -9 ${arrayInfo[1]}&#8221;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kill -9 ${arrayInfo[1]}<br \/>&nbsp;&nbsp;&nbsp; fi<\/p>\n<p>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>start(){<br \/>&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nStart Java App.\\n######################&#8221;<br \/>&nbsp;&nbsp;&nbsp; `set timeout 1`<br \/>&nbsp;&nbsp;&nbsp; runStage=$1<br \/>&nbsp;&nbsp;&nbsp; cd &#8220;$APPS_HOME\/default&#8221;<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ ! -n &#8220;$runStage&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runStage=&#8221;bg&#8221;<br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ &#8220;bg&#8221; = &#8220;$runStage&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nohup java -Xmx3096m -Xms3096m -Xss2048k -cp <span style=\"color: #ff0000;\">${defailt-classpath}<\/span>:<span style=\"color: #ff0000;\"><strong>${jar-location}\/* &nbsp; &nbsp;<\/strong> <strong>${main-class}<\/strong><\/span> &#8211;spring.config.location=file:<span style=\"color: #ff0000;\"><strong>${file1}<\/strong><\/span>,file:<span style=\"color: #ff0000;\"><strong>${file2}<\/strong><\/span>,file:<span style=\"color: #ff0000;\"><strong>${file3} <\/strong><\/span>&gt; \/dev\/null 2&gt;&amp;1 &amp;<br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; if [ &#8220;fg&#8221; = &#8220;$runStage&#8221; ]; then<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java -Xmx3096m -Xms3096m -Xss2048k -cp <span style=\"color: #ff0000;\">${defailt-classpath}<\/span>:<span style=\"color: #ff0000;\"><strong>${jar-location}\/* &nbsp; &nbsp;<\/strong> <strong>${main-class}<\/strong><\/span> &#8211;spring.config.location=file:<span style=\"color: #ff0000;\"><strong>${file1}<\/strong><\/span>,file:<span style=\"color: #ff0000;\"><strong>${file2}<\/strong><\/span>,file:<span style=\"color: #ff0000;\"><strong>${file3},&#8230;..<\/strong><\/span><br \/>&nbsp;&nbsp;&nbsp; fi<br \/>&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; return 0;<br \/>}<\/p>\n<p>case $1 in<br \/>&nbsp;&nbsp;&nbsp; build)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; build $@<br \/>&nbsp;&nbsp;&nbsp; ;;<br \/>&nbsp;&nbsp;&nbsp; sync)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; synchronized<br \/>&nbsp;&nbsp;&nbsp; ;;<br \/>&nbsp;&nbsp;&nbsp; start)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start $2<br \/>&nbsp;&nbsp;&nbsp; ;;<br \/>&nbsp;&nbsp;&nbsp; kill)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; killProcess<br \/>&nbsp;&nbsp;&nbsp; ;;<br \/>&nbsp;&nbsp;&nbsp; *)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; synchronized<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; build<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; makeAppDir<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; copy-bin<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; killProcess<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; relink<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start<br \/>&nbsp;&nbsp;&nbsp; ;;<br \/>esac&nbsp;&nbsp;&nbsp; <br \/>exit 0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash APPS_HOME=${base_dir_to_be_installted}INSTALL_DIR=&#8221;$APPS_HOME\/&#8221;`date +%Y%m%d-%H%M`SOURCE_HOME=`pwd` synchronized(){&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nMake newest\\n######################&#8221;&nbsp;&nbsp;&nbsp; set timeout 1&nbsp;&nbsp;&nbsp; git reset &#8211;hard HEAD&nbsp;&nbsp;&nbsp; git checkout master &nbsp;&nbsp;&nbsp; expect -c&#8221;&nbsp;&nbsp;&nbsp; set timeout 4&nbsp;&nbsp;&nbsp; spawn git pull &#8211;all&nbsp;&nbsp;&nbsp; expect &#8216;Password: &#8216;&nbsp;&nbsp;&nbsp; send ${password}\\r&nbsp;&nbsp;&nbsp; expect eof&#8221;&nbsp;&nbsp;&nbsp; return 0;} build() {&nbsp;&nbsp;&nbsp; echo -e &#8220;\\n\\n\\n######################\\nBuild Source\\n######################&#8221;&nbsp;&nbsp;&nbsp; `set timeout 1`&nbsp;&nbsp;&nbsp; profile=$2&nbsp;&nbsp;&nbsp; if [ ! -n &#8220;$profile&#8221; ];&nbsp; then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; profile=&#8221;stage&#8221;&nbsp;&nbsp;&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[163],"tags":[],"class_list":["post-1867","post","type-post","status-publish","format-standard","hentry","category-about-knowledge-programs_java"],"_links":{"self":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts\/1867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/comments?post=1867"}],"version-history":[{"count":0,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/posts\/1867\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/media?parent=1867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/categories?post=1867"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.msinterdev.org\/wp\/wp-json\/wp\/v2\/tags?post=1867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}