本来 Local 的 Updated 是 Error 的状态,忘记截图了,只好用已经解决的结果效果图,Error 差不就和远程差不多。
这里的关键所在无需解决 Remote 远程问题,只需要解决 Local Error 的问题,就可以远程。
测试记录:
测试环境:
maven 3.8.4
Java 8
在本地安装 Maven,安装链接如下所示:
超详细maven的卸载、重新安装与配置
笔者没那么复杂,但笔者建议在配置这个镜像
前,最好是先 Update 一下,先更新下中央仓库的索引,即先加上
然后 Update 后,再添加
,如果这样子还无法解决 Local 本地仓库的 Error 问题,那么就要考虑梯子,可以,然后在更新 Update 如下:
<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:/Environment/maven-3.8.1/myRepositorylocalRepository>
<pluginGroups>
pluginGroups>
<proxies>
proxies>
<servers>
servers>
<mirrors>
mirrors>
<profiles>
profiles>
settings>
只关注 Local,而 Remote 的不用理会。
使用记事本或Visual Studio 等软件工具打开
settings.xml
,将文件中的所有信息替换为如下,并保存后退出:
(注意: D:/Environment/maven-3.8.1/myRepository 中间的路径是之前创建的本地仓库的位置,==根据实际改成自己的仓库位置,路径的分隔符改为/ ==,其实 \
反斜杠也是可以的。)
<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:/Environment/maven-3.8.1/myRepositorylocalRepository>
<pluginGroups>
pluginGroups>
<proxies>
proxies>
<servers>
servers>
<mirrors>
<mirror>
<id>alimavenid>
<name>aliyun mavenname>
<url>http://maven.aliyun.com/nexus/content/groups/public/url>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>aliyunid>
<mirrorOf>centralmirrorOf>
<name>aliyun-publicname>
<url>https://maven.aliyun.com/repository/public/url>
mirror>
<mirror>
<id>aliyun-springid>
<mirrorOf>springmirrorOf>
<name>aliyun-springname>
<url>https://maven.aliyun.com/repository/springurl>
mirror>
<mirror>
<id>maven.net.cnid>
<name>one of the central mirrors in chinaname>
<url>http://maven.net.cn/content/groups/public/url>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>repo1id>
<mirrorOf>centralmirrorOf>
<name>Human Readable Name for this Mirror.name>
<url>https://repo1.maven.org/maven2/url>
mirror>
mirrors>
<profiles>
profiles>
settings>
如果出现一些 import 导入或 Jdk 版本问题,有可能呢需要修改为本地的 jdk
选择对应的 JDK 1.8 ,这里笔者使用的是本地安装的 JAVA_HOME
路径的 Java 编译器。
最后记得 Apply