背景:
最近由于公司关闭了外网环境,所以需要把maven打包方式改为在本地仓库离线打包。
1、修改maven配置文件:
localRepository改为本地仓库位置
D:\WorkSpace\WorkSoft\maven-repository\iwhalecloud-repository\business
mirrors同时改为本地仓库位置,把其余在线的镜像地址给注释掉
central central file://D:/WorkSpace/WorkSoft/maven-repository/iwhalecloud-repository/business *
2、pom文件中存在RELEASE版本的改为固定版本
org.jetbrains annotations RELEASE compile
更改为
org.jetbrains annotations 23.0.0 compile
3、在本地仓库中还需删除_remote.repositories文件,打开cmd命令行,切换至仓库目录下执行如下命令
for /r %i in (_remote.repositories) do del %i
4、最终打包命令:
mvn clean package -s "E:\work soft\maven\common_conf\settings_crm_local.xml"