注:Jenkins构建Maven项目时,需要联网到(国外)Maven仓库下载相应的jar包,速度较慢。通过搭建Nexus作为Maven仓库管理器,能快速实现项目的构建。
1.压缩本地仓库jar包
将本地maven/repository仓库打一个完整的zip压缩包,如:repository.zip
2.上传
上传到linux目录,如:/opt/repository.zip
3.解压
unzip /opt/repository.zip
4.创建脚本
在repository目录下创建脚本mavenImport.sh ;
脚本内容如下:
#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important