Talk is cheap, show me the code.
环境 | Environment
k | version |
---|---|
OS | windows 11 |
jdk | 1.8 |
maven | 3.6.0 |
junit | junit4 mian |
复现步骤 | Reproduction steps
git clone git@github.com:tanpenggood-fork/junit4.git
cd junit4
mvn verify
报错日志 | Error log
[ERROR] Plugin org.apache.maven.plugins:maven-enforcer-plugin:1.4 or one of its dependencies
原因分析 | Analysis
阿里的镜像更新了,所以用https
了而不是http
解决方案 | Solution
-
settings.xml
url 使用https
<?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"> <pluginGroups> </pluginGroups> <proxies> </proxies> <servers> </servers> <mirrors> <!-- 阿里云镜像 --> <mirror> <id>aliyun</id> <name>aliyun Maven</name> <mirrorOf>*</mirrorOf> <url>https://maven.aliyun.com/nexus/content/groups/public/</url> </mirror> </mirrors> <profiles> </profiles> <activeProfiles> </activeProfiles> </settings>
-
VIM Options 开启
ssl证书验证
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true