1、登陆到jenkins首页,创建项目-->选择maven-->输入项目名称-->选择项目类型
2、进入项目配置:{先写一下项目描述和设置下保留的历史构建,然后向下拉}
找到源吗管理(这里我们还是使用Gitlab)然后继续向下拉
向下拉找到build(此时会有一个报错,说找不到maven)
配置maven
1、什么也不做,到这里保存my-maven项目
2、回到jenkins首页-->系统管理-->全局工具配置
3、向下拉-->找到maven-->新增maven
4、此时到你的jenkins服务器上去手动安装Maven,也可以自动安装,但是个人习惯手动安装(自动装的不知道他给装在哪了),这里需要注意的是(你的maven版本要和开发用的maven版本一致,如果不一样我也不知道会出现什么后果)
1、maven安装 # ls apache-maven-3.3.9-bin.tar.gz # tar xf apache-maven-3.3.9-bin.tar.gz -C /usr/local/ # export PATH=$PATH:/usr/local/apache-maven-3.3.9/bin # echo "export PATH=$PATH:/usr/local/apache-maven-3.3.9/bin" >>/etc/profile # . /etc/profile 2、验证是否安装成功(出现以下信息表示成功) # mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00) Maven home: /usr/local/apache-maven-3.3.9 Java version: 1.8.0_121, vendor: Oracle Corporation Java home: /usr/local/jdk1.8.0_121/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-693.11.1.el7.x86_64", arch: "amd64", family: "unix"
5、到jenkins上配置maven
6、接下来继续道my-maven项目里面配置
7、保存后我们去构建一下试试