java - 无法传输 http://repo.maven.apache.org/maven2 - 错误代码 501,需要 HTTPS
问题描述
我有一个虚拟机,我正在使用 spring 工具套件和 JDK7。
我已经从 git 下载了我的项目,但在 pom.xml 中出现错误:
Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom. Error code 501, HTTPS Required
小米pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
测试过。删除.m2,maven clean,...
我需要改变什么?
解决方案
我相信错误正如它所说:它不支持未加密的请求。因此,我们应该将您的 URL 更改为 HTTPS。
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
如果由于某种原因您不能使用 HTTPS,请使用:
http://insecure.repo1.maven.org/maven2/
对于 Maven 存储库。
只是做了一个快速搜索,如果您想了解更多信息,可以找到一些参考资料:
由于您在阅读时遇到了一些问题,因此您需要更新您的 pom.xml 文件,我相信并更新您的 maven URL。它应该看起来像这样,或者使用类似的逻辑来使用上面的特定 URL 进行更新(如果没有您的 POM 文件部分,很难发布一个示例)。
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
推荐阅读
- python - 如何使用 docker 使 python 日志记录持久化
- python - Python逐个对象写入json文件对象
- string - LabVIEW 搜索多个字符串
- python - Keras 模型无法预测是否在线程中调用
- java - Springboot/Cucumber集成-如何在步骤定义类中使用@Autowired(或其他SB标签)?
- php - 我不明白如何使用 PHP 配置 REST API Sinch
- html - 如果 .html 文件不包含标记,IIS 不会返回内容
- python - 在 django 中使用 id 查找用户名
- c# - 从对象序列化到 XML 节点
- mongodb - MongoDB索引升序或降序事项