背景
公司代码在内网开发,内网的maven
仓库使用的代理的华为maven仓库即https://repo.huaweicloud.com/repository/maven/
,在编译 apache-griffin-6.0
时发现无法下载jar包
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-client</artifactId>
<version>${confluent.version}</version>
</dependency>
原因是该jar包的仓库是http://packages.confluent.io/maven/
内网访问不通,故下载不到。
<repositories>
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
</repository>
</repositories>
解决
思路
通过外网将jar下到本地,将localRepository打包传到内网,内网使用本地仓库开发。
配置maven使用本地仓库的办法如下:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:/maven-repository</localRepository>
<mirrors>
<mirror>
<id>local</id>
<mirrorOf>*</mirrorOf>
<name>local</name>
<url>file://D:\maven-repository</url>
</mirror>
</mirrors>
</settings>
注意:localRepository的值要和mirrors.mirror.url保持一致
经过配置,在内网即可让mvn使用本地仓库打包。