当前位置:网站首页>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边栏推荐
猜你喜欢

Osg环境搭建(Win10+Vs2019)

2022.6.10 stm32mp157 serial port clock learning

浅记一下十大排序

论文报告-Linear Regression for face recognition

IP核之ROM

一张图看懂指针

What is the difference between single line and three line when renting servers in Hong Kong?

Code implementation and introduction of all commonly used sorting

无法启动程序,拒绝访问?

力扣每日一题leetcode 513. 找树左下角的值
随机推荐
Solve binary tree (5)
wireshark图形界面抓包
Multi task foundation of IOT operating system
编程学习记录——第4课【分支和循环语句】
C语言-文件操作
编程学习记录——第9课【操作符】
geonode geoserver win10 安装教程(亲测)
遥感影像识别-制作数据集
Weidongshan digital photo frame project learning (II) displaying Chinese characters on LCD
Unity Shader 概述
自动化部署项目
通信机制案例
ROS话题名称设置
Dynamic programming for solving problems (7)
力扣 236. 二叉树的最近公共祖先
数据库索引的一些说明以及使用
这是我的博客
力扣题解 动态规划(1)
编程学习记录——第7课【函数】
力扣题解 动态规划(6)