我有一个带有本地依赖项的maven项目,由于maven引入了这种'改进',所以它不能编译:
[自2020年1月15日起生效,中央存储库不再支持通过纯HTTP进行的不安全通信,并要求所有请求通过HTTPS对存储库进行加密。
这是我的pom.xml:
...
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
...
所以现在我收到以下编译错误:
无法解析项目........ :: war:1.0的依赖项:无法收集[.........:jar:1.0(编译)的依赖项,javax:javaee-web-api:jar:7.0(提供),.........:jar:1.0((编译)):无法读取工件描述符.........:jar:1.0:无法传输工件.........:POM:1.0从/到中央(http://repo.maven.apache.org/maven2):无法传输文件:http://repo.maven.apache.org/maven2/com/..../..../1.0/.....-1.0.pom。返回码是:501,ReasonPhrase:HTTPS必需。 -> [帮助1]
您可以看到我正在使用本地jar文件,但这不再编译了
有人知道如何配置本地存储库以成功进行编译吗?
Maven服务器不再支持HTTP。您必须在本地maven配置文件中的主文件夹yourname / .m2 / settings.xml中使用HTTPS URL配置Maven存储库。
以下是您可以复制的示例:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://repo1.maven.org/maven2/</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>https://repo1.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>