解决maven中某些依赖无法下载,手动安装Maven依赖
阅读原文时间:2023年07月08日阅读:1
<!--先下载jar包,然后在仓库中手动安装,下面是遇到的两个例子-->
<!--第一个-->
mvn install:install-file -Dfile=D:\kaptcha-2.3.jar -DgroupId=com.google.code.kaptcha -DartifactId=kaptcha -Dversion=2.3 -Dpackaging=jar -DgeneratePom=true
<!--第二个-->
mvn install:install-file -Dfile=D:\fastdfs-client-java-1.27-RELEASE.jar -DgroupId=org.csource -DartifactId=fastdfs-client-java -Dversion=1.27-RELEASE -Dpackaging=jar -DgeneratePom=true

这样做如果还是遇到依赖无法下载,需要检查一下maven的配置文件,conf下的setting.xml文件中是否设置了代理。代理需要设置正确。

<proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username></username>
        <password></password>
        <host>你的域名</host>
        <port>你的端口</port>
        <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
</proxies>