第一步:jenkins安装maven插件
系统管理 -->插件管理 --> Maven Integration
第二步:新建maven项目
第三步:
①:配置git连接
②:添加密钥
③:这个时候会出一个错误 大概意思是jenkins版本和git版本不一致git版本太低造成的
# 运行以下命令解决 (就是升级nss 具体是什么我也不太清楚)
yum update -y nss curl libcurl
第四步:
①:配置pom文件
②:会出现一个问题会提示你没有安装maven ,所以这个时候需要在Linux 安装 maven (前提是你需要安装了java)
# 下载maven插件
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
# 解压maven
tar -zxvf apache-maven-3.6.3-bin.tar.gz
# 配置环境变量
vim /etc/profile
# 添加环境变量
export MAVEN_HOME=/opt/soft/apache-maven-3.6.3
export PATH=${MAVEN_HOME}/bin:$PATH
# 刷新环境
source /etc/profile
# 查看maven
mvn -version
Maven home: /opt/soft/apache-maven-3.6.3
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /opt/soft/jdk8/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.el7.x86_64", arch: "amd64", family: "unix
# 配置maven阿里云仓库
vim /opt/soft/apache-maven-3.6.3/conf/settings.xml
# 找到 mirrors 标签 添加
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
③:jenkins 配置maven
系统管理==》全局工具配置
第五步 : 配置都已经完成了可以构建项目了