简体   繁体   English

Spring Boot项目无法解决依赖关系-无法在org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE上收集依赖关系

[英]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.

相关问题 SPRING BOOT/无法在 org.springframework.boot:spring-boot-starter:jar:1.0.0.RC5 收集依赖项 - SPRING BOOT/ Failed to collect dependencies at org.springframework.boot:spring- boot-starter:jar:1.0.0.RC5 找不到 org.springframework.boot:spring-boot-starter-web:。 要求:项目: - Could not find org.springframework.boot:spring-boot-starter-web:. Required by: project : Spring依赖关系-org.springframework.boot与org.springframework - Spring Dependencies - org.springframework.boot vs org.springframework Spring 引导:托管版本为 1.3.2.RELEASE 工件在 org.springframework.boot:spring-boot-dependencies:1.3.2.RELEASE 中管理 - Spring Boot: The managed version is 1.3.2.RELEASE The artifact is managed in org.springframework.boot:spring-boot-dependencies:1.3.2.RELEASE 未找到依赖项 'org.springframework.boot:spring-boot-starter-security:2.2.6.RELEASE' - Dependency 'org.springframework.boot:spring-boot-starter-security:2.2.6.RELEASE' not found 找不到 org.springframework.boot:spring-boot-starter-parent:2.4.9.RELEASE - Could not find org.springframework.boot:spring-boot-starter-parent:2.4.9.RELEASE 未找到项目“org.springframework.boot:spring-boot-starter-parent:2.6.0-SNAPSHOT” - Getting Project 'org.springframework.boot:spring-boot-starter-parent:2.6.0-SNAPSHOT' not found 项目 'org.springframework.boot:spring-boot-starter-parent:2.4.0' 未找到 - Project 'org.springframework.boot:spring-boot-starter-parent:2.4.0' not found 无法执行目标 org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:run - Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:run 无法执行目标 org.springframework.boot:spring-boot-maven-plugin:2.1.0.RELEASE - Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.0.RELEASE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM