[英]Spring boot project not resolving dependencies - Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE
I was having a problem with setting up a spring demo project and did not easily find a solution online. 我在设置Spring演示项目时遇到问题,无法轻松地在线找到解决方案。 Below lays out the details and I found a way to make it work (I'll add as an answer) for me and maybe it'll help someone else.
下面列出了详细信息,我找到了一种使之起作用的方法(我将作为答复添加),也许会对其他人有所帮助。
I am following the guide for building REST services with spring: https://spring.io/guides/tutorials/bookmarks/ 我正在遵循使用spring构建REST服务的指南: https : //spring.io/guides/tutorials/bookmarks/
In the guide, it says to go to https://start.spring.io/ and select the following: Web, JPA, H2, and Lombok. 在指南中,它说到https://start.spring.io/并选择以下内容:Web,JPA,H2和Lombok。
I downloaded, upnzipped, and imported it into my Spring Tool Suite in Eclipse. 我下载,升级并导入到Eclipse中的Spring Tool Suite中。 Right away it can be seen that the project has issues so I right-click the project -> Maven -> Update Project... This did not resolve so next I did was:
马上可以看到该项目有问题,所以我右键单击该项目-> Maven->更新项目...这没有解决,所以接下来我要做的是:
Right-click project -> Run As -> Maven install 右键单击项目->运行方式-> Maven安装
This results with BUILD FAILURE: 结果导致BUILD FAILURE:
Failed to execute goal on project restDemo: Could not resolve dependencies for project com.example:restDemo:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE -> org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Failed to read artifact descriptor for org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.3 from/to central ( https://repo.maven.apache.org/maven2 ): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] 无法对项目restDemo执行目标:无法解决项目com.example:restDemo:jar:0.0.1-SNAPSHOT的依赖项:无法在org.springframework.boot:spring-boot-starter-web:jar:2.1上收集依赖项.1.RELEASE-> org.hibernate.validator:hibernate-validator:jar:6.0.13.Final:无法读取org.hibernate.validator:hibernate-validator:jar:6.0.13的工件描述符.Final:无法从/到中心( https://repo.maven.apache.org/maven2 )传输工件org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.3:sun.security.validator.ValidatorException:PKIX路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法找到到请求目标的有效证书路径-> [帮助1]
I am behind a corporate firewall and I figured it had something to do with not being able to get all the dependencies. 我在公司防火墙后面,我认为这与无法获取所有依赖关系有关。
I added this to my pom.xml (note url uses http instead of https): 我将其添加到pom.xml中(注意url使用http而不是https):
<repositories>
<repository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
Ultimately, I put that in my settings.xml file (found in C:\\Users\\user\\.m2 directory) so that I don't have to add this to all my project pom.xml files. 最终,我将其放在我的settings.xml文件中(位于C:\\ Users \\ user \\ .m2目录中),这样我就不必将其添加到我的所有项目pom.xml文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.