当前位置:网站首页>Automated Deployment Project
Automated Deployment Project
2022-07-27 06:12:00 【Drunk and refreshing】
Catalog
3、 ... and 、 Server configuration
Four 、 automation shell Script
One 、 To write maven project
First of all, you should create it locally maven project , And the corresponding configuration , I won't give you a detailed introduction here , Various maven Projects can be
Two 、git Push and clone of
1、 Create locally git Warehouse , Submit it to the local warehouse
2、 stay gitee Or build a code warehouse on Tencent cloud , And idea Connect , And in idea Admiral maven Push the project to the warehouse
3、 On your server , Create a folder to store the cloned project , Name as you like
4、 If you are right about git If the operation is not very familiar , You can refer to
https://blog.csdn.net/wuminglq/article/details/104310943
3、 ... and 、 Server configuration
1、 Unified maven
Put the maven And your local maven Unified version , Install the same version as the local version on the server
First download maven The package , Select the corresponding version of the compressed package at this address
https://maven.apache.org/download.cgi
Then decompress the compressed package , Use linux command tar -zxf perhaps tar -zxvf unpack
After decompression , Need configuration maven Warehouse and set Alibaba image warehouse , Use here maven-3.6.3 Display accordingly
a、 Create warehouse Directory
cd apache-maven-3.6.3 # Get into apache-maven-3.6.3 Catalog
mkdir ck # establish ck Catalog b、 Get into cd conf Catalog , edit vi settings.xml file , find ·localRepository Copy a line below and add <localRepository>/usr/local/apache-maven-3.6.3/ck</localRepository>, Find mirror Plus Ali's warehouse configuration , When the configuration is completed, an error is reported and the system exits
cd conf # Get into conf Catalog
vi settings.xm # settings.xm file maven Warehouse address
<localRepository>/usr/local/apache-maven-3.6.3/ck</localRepository>Set Ali image warehouse
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>c、 To configure maven environment variable , edit :vi /etc/profile file , Turn to the last line and add export MAVEN_HOME=/usr/local/apache-maven-3.6.3 export PATH=$PATH:$MAVEN_HOME/bin Save and exit
vi /etc/profileexport MAVEN_HOME=/usr/local/apache-maven-3.6.3
export PATH=$PATH:$MAVEN_HOME/bind、 Reload it ,source /etc/profile Make the new configuration effective
source /etc/profilee、 This completes the installation , Test it , Enter the command :mvn -v
mvn -v
This completes the installation .
2、git install
install git Use yum Command is enough
Four 、 automation shell Script
To write a script, you must first understand the order of execution
Write the basic idea of the script I designed , For reference only , The specific situation also depends on the location of your server related tools
1、 First, enter the project you cloned into the server in No. 2 middle school , notice pom.xml that will do , Execute... In this directory git pull command , Update the modified content on the server to the server , Then perform mvn clean and mvn install command , The first of these two commands is to clear the target Catalog , The second command is to create target Catalog , And mark the project as war Put the bag in it .
2、 Put... On your server tomcat Inside webapps The original and updated projects in have the same name , take war Package to delete , take war Move the extracted project file to another folder and rename it
3、 Go back to the project you cloned target Under the table of contents , Will be one of the war Package is copied to the tomcat Medium webapps Under the table of contents
4、 restart tomcat
Overall shell The script is as follows , Some modifications have been made , Project name , Path and other issues need to be modified
#!/bin/bash
cd /web/automation/ Project name // there automation Is to create a folder for storing the project , You can choose your own name
git pull Yours gitee The clone address of the warehouse or Tencent cloud warehouse
mvn clean
mvn install
cd /web/apache-tomcat-8.0.9/webapps
rm -rf ssm.war
mv ssm /recycle/ssm$(date +%Y%m%d-%H%M%S) //recycle It is a folder used to store the original moved items
cd /web/automation/ Project name /target
cp ssm.war /web/apache-tomcat-8.0.9/webapps
# restart tomcat
cd /web/apache-tomcat-8.0.9/bin
./shutdwn.sh
./startup.sh边栏推荐
猜你喜欢
随机推荐
力扣题解 动态规划(1)
[first song] rebirth of me in py introductory training (3): if conditional sentence
自动化部署项目
技术和理论知识学习的一点心得
力扣题解 单调栈
力扣 236. 二叉树的最近公共祖先
TF坐标变换
yum获取rpm软件包的三种方法
PZK学C语言之初识指针
力扣题解 动态规划(4)
wireshark图形界面抓包
链表回文判断
通信机制案例
socket 长链接
Baiwen driver Daquan learning (I) LCD driver
Unity 引擎开始从 Mono 迁移到 .NET CoreCLR
编程学习记录--第2课【初识C语言】
Li Kou 236. the nearest common ancestor of binary tree
Dynamic programming for solving problems (1)
ROS中的头文件与源文件








