Since Maven 3.8.1 http repositories are blocked.
时间: 2023-11-11 22:58:48 浏览: 114
好的,您的问题是关于 Maven 3.8.1 的 http 仓库被禁用的问题。这个问题的背景是,由于安全原因,Maven 3.8.1 默认禁止使用 http 协议进行依赖包的下载,只允许使用 https 协议。这样可以保护用户的系统免受中间人攻击等安全威胁。
如果您需要使用 http 仓库,可以手动在 Maven 的配置文件中添加如下配置:
```
<repositories>
<repository>
<id>central-http</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
```
这样 Maven 就会尝试从 http://central 仓库获取依赖包了。
相关问题
since maven 3.8.1 http repositories are blocked.
从 Maven 3.8.1 开始,HTTP 仓库被默认阻止,这是因为 Maven 团队发现 HTTP 协议不安全,并且 Maven 应该使用更安全的 HTTPS 协议来下载依赖项。这意味着,如果您尝试使用 HTTP URL 来访问 Maven 仓库,您将会遇到错误。
如果您需要访问 HTTP 仓库,则可以在 Maven 配置文件中添加以下内容以允许使用 HTTP 协议:
```
<settings>
<servers>
<server>
<id>myrepo</id>
<url>http://myrepo.example.com/repo</url>
</server>
</servers>
<mirrors>
<mirror>
<id>myrepo</id>
<url>http://myrepo.example.com/repo</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>myrepo</id>
<url>http://myrepo.example.com/repo</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
</settings>
```
Since Maven 3.8.1 http repositories are blocked
从Maven 3.8.1开始,http仓库被阻止了。您可以尝试以下解决方案之一来解决这个问题:
1. 将Maven升级到最新版本。
2. 在Maven命令中添加-Dmaven.wagon.http.allowAll=true参数来允许HTTP请求。但请注意,这不是一个安全的解决方案,不建议长期使用。
此外,您还可以在pom.xml文件中添加repositories标签来指定HTTPS地址,例如:
```xml
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
```
或者,在settings.xml文件中添加mirrors标签来指定HTTPS地址,例如:
```xml
<mirrors>
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Central HTTPS</name>
<url>https://repo.maven.apache.org/maven2</url>
</mirror>
</mirrors>
```