通過dos檢測道maven安裝成功后,在maven的conf目錄下修改settings.xml檔案中的國內鏡像時,執行mvn help:system命令時出錯,原因在于url地址出錯,如下我網上找到的阿里云鏡像:
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
原因在于url地址中最后的/,將其洗掉保存即可,如下
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
然后重啟dos,再次執行mvn help:system,
等待片刻,看到下圖中顯示的BUILD SUCCESS字樣,即代表更換國內鏡像成功

還有個問題需注意下,上面成功后,在idea里maven還遇到錯誤:
Maven:sun.security.validator.ValidatorException: PKIX path building failed
這個是 HTTPS 的證書安全檢查問題,最簡單的方式是忽略SSL的證書檢查,在 maven 打包命令中加上引數-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true,如下圖

我記得還有個問題是IDEA和Maven的版本兼容問題,忘記了,你們注意一下
這里放上我的setting.xml檔案,以供參考
<?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>E:\Maven\maven-repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
還有關鍵資訊截圖也放上來



轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/215938.html
標籤:其他
上一篇:JavaWeb商城專案(Day05)Web層(登錄頁面的html+Servlet程式)
下一篇:某校2019專碩編程題-佇列
