Java Web project compiles and deploys scripts automatically in a Linux environment

Source: Internet
Author: User

Automatically compiles the script build.sh, placed under the project root directory.

#!/bin/bash# Check args# init pathcurrpath=`pwd' Libdir="$CURRPATH/webcontent/web-inf/lib"SRC="$CURRPATH/src"CLASS="$CURRPATH/webcontent/web-inf/classes"if[-a $CLASS]; Then        RM-RF $CLASS/*Else        mkdir$CLASSfiCLASSPATH="$CLASSPATH"TMP=`Find$LIBDIR-name"*.jar"|awk '{var=$0 ":" var;} End{print var;}'' CLASSPATH="$TMP $classpath"Echo "classes: $CLASS"Javac-sourcepath $SRC-classpath $CLASSPATH-D $CLASS 'Find$SRC-name"*.java"' WebContent/deploy.SH

Automatic deployment Script deploy.sh, placed inwebcontent/directory.

#!/bin/bash# Check argsproj="UFE"WAR="$PROJ. War"if[$#-ne1]; ThenTOMCAT="/usr/local/tomcat"ElseTOMCAT=$1fiBAK="$TOMCAT/bak"if[-a $BAK]; Then        ls$BAKElse        mkdir$BAKfiif[-a $WAR]; Then        RM-F $WARfiWEBROOT=`pwd`if[-a $WAR]; Then        RM-F $WARfiEcho "JAR-CVF $WAR"Jar-CfM $WAR. Bakwar="$BAK/$WAR"if[-a $BAKWAR]; ThenI=1         while[-A $BAK/$WAR. $i]]  Do((i++))         Done        MV$BAKWAR $BAK/$WAR. $ifi$TOMCAT/bin/shutdown.SHDIS="$TOMCAT/webapps/$WAR"if[-a $DIS]; Then        MV$DIS $BAKWARRM-F $DISfiFolder="$TOMCAT/webapps/$PROJ"if[-a $Folder]; Then        RM-RF $FolderfiCP$WAR $DIS $tomcat/bin/startup.SH

Java Web project compiles and deploys scripts automatically in a Linux environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.