背景:
内网项目打包,解决Cannot access central in offline mode?
1、修改maven配置文件:
localRepository改为本地仓库位置
<localRepository>D:\WorkSpace\WorkSoft\maven-repository\iwhalecloud-repository\business</localRepository>
mirrors同时改为本地仓库位置,把其余在线的镜像地址给注释掉
<mirror>
<id>central</id>
<name>central</name>
<!-- 将镜像地址设置为本地maven地址 -->
<url>file://D:/WorkSpace/WorkSoft/maven-repository/iwhalecloud-repository/business</url>
<mirrorOf>*</mirrorOf>
</mirror>
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"