Maven 501 报错解决方式
在执行 mvn clean
后报错:
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:3.2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:3.2.0
: The following artifacts could not be resolved: org.apache.maven.plugins:maven-clean-plugin:pom:3.2.0 (present, but unavailable): Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:
3.2.0 from/to repo1 (http://repo1.maven.org/maven2/): status code: 501, reason phrase: HTTPS Required (501) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
The following artifacts could not be resolved: org.apache.maven.plugins:maven-clean-plugin:pom:3.2.0 (present, but unavailable): Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:
3.2.0 from/to repo1 (http://repo1.maven.org/maven2/): status code: 501, reason phrase: HTTPS Required (501) -> [Help 1]
可以看到是 repo1
的源错误
配置 maven
源修改http
为 https
:
在 IDEA
的 File-Setting
红框路径下可以找到 IDEA
的 Maven
的配置文件
让 Maven
忽略证书效验
在 VM Options
中添加以下代码,然后重启 IDEA
。
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true