ITPub博客

首页 > IT职业 > IT生活 > 将Git上的Maven项目自动化打包部署到服务器(Linux服务器——

将Git上的Maven项目自动化打包部署到服务器(Linux服务器——

IT生活 作者:mocow 时间:2021-09-09 09:05:43 0 删除 编辑

最近忙了一段时间,项目需要发布测试,但是每次修改bug后都需要重新把代码从git上pull下来然后maven打包再发布实在繁琐,于是索性就写一个脚本,将Maven项目自动化打包部署到服务器,遂用手记记录一下,分享给大家。

一、在服务器上安装git服务

图片描述

[root@VM_183_120_centos ~]# git --version                  
-bash: git: command not found
[root@VM_183_120_centos ~]# yum -y install git

这里的git --version是查看git版本,git: command not found说明还没有安装,所以通过yum一键安装。见下图查看安装后的版本是1.8.3.1【虽然不是最新版本】,现在已经安装成功。
图片描述

二、配置maven

下载maven3.5并解压
图片描述

[root@VM_183_120_centos ~]# mkdir /data/software
[root@VM_183_120_centos ~]# cd /data/software/
[root@VM_183_120_centos software]# wget http://apache.fayea.com/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

[root@VM_183_120_centos software]# ll
total 8352
-rw-r--r-- 1 root root 8534562 Apr  7 16:29 apache-maven-3.5.0-bin.tar.gz
[root@VM_183_120_centos software]# tar -zxvf apache-maven-3.5.0-bin.tar.gz 

改个名字(配置环境变量方便)
图片描述

drwxr-xr-x 6 root root    4096 Aug 25 09:49 apache-maven-3.5.0
-rw-r--r-- 1 root root 8534562 Apr  7 16:29 apache-maven-3.5.0-bin.tar.gz
//马赛克
[root@VM_183_120_centos software]# mv apache-maven-3.5.0 maven
[root@VM_183_120_centos software]# ll
total 8356
-rw-r--r-- 1 root root 8534562 Apr  7 16:29 apache-maven-3.5.0-bin.tar.gz
drwxr-xr-x 6 root root    4096 Aug 25 09:49 maven
[root@VM_183_120_centos software]# 

配置环境变量

[root@VM_183_120_centos software]# vi /etc/profile

图片描述

[root@VM_183_120_centos software]# source /etc/profile
[root@VM_183_120_centos software]# mvn -v

图片描述

三、tomcat下载安装

下载tomcat
图片描述

[root@VM_183_120_centos software]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz
[root@VM_183_120_centos software]# tar -zxvf apache-tomcat-8.5.20.tar.gz 

图片描述

[root@VM_183_120_centos software]# mv apache-tomcat-8.5.20 tomcat

[root@VM_183_120_centos software]# sh tomcat/bin/startup.sh

到此我们基本环境就配置好了

如果有问题可以在文章下方评论或私聊我哦。


下一篇:

将Git上的Maven项目自动化打包部署到服务器(Linux服务器——脚本篇)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2815/viewspace-2799340/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-17

  • 博文量
    108
  • 访问量
    1364