简体   繁体   English

未找到依赖项 'org.springframework.boot:spring-boot-starter-validation:2.5.1'

[英]Dependency 'org.springframework.boot:spring-boot-starter-validation:2.5.1' not found

How can I solve the issue of "Dependency 'org.springframework.boot:spring-boot-starter-validation:2.5.1' not found" ?如何解决“未找到依赖关系 'org.springframework.boot:spring-boot-starter-validation:2.5.1'”的问题?

My pom.xml file loks like this:我的 pom.xml 文件看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>JavaDeveloperTask</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${project.parent.version}</version>
            </plugin>
        </plugins>
    </build>

</project>

I have added我已经添加了

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>

But it still gives me the error.但它仍然给我错误。 What could be th cause of this?这可能是什么原因?

Works for me.为我工作。 Central repo have this dependency: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-validation/2.5.1/中央仓库有这个依赖: https : //repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-validation/2.5.1/

So i don't see why it should not work.所以我不明白为什么它不应该工作。 Maybe there was some kind of network issue.也许有某种网络问题。

Try to remove it from local maven repo and download again.尝试将其从本地 Maven 存储库中删除并重新下载。 You can find maven repo in your user home dir .m2 , delete .m2/repository/org/springframework/boot/spring-boot-starter-validation/2.5.1 folder您可以在您的用户主目录.m2找到 maven repo,删除.m2/repository/org/springframework/boot/spring-boot-starter-validation/2.5.1文件夹

You should try to close the project and re-open it, the dependency will get downloaded by itself.您应该尝试关闭项目并重新打开它, dependency将自行下载。

Worked in my case.在我的情况下工作。

@ekm0d. @ekm0d。 I had the same problem using the Intellij IDEA .我在使用Intellij IDEA遇到了同样的问题。 Here what I did and worked for me after inserting this on pom.xml :这是我在pom.xml上插入后为我所做的和为我工作的:

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
</dependency>
  1. Right-click on the project file.右键单击项目文件。
  2. Click on Maven单击Maven
  3. Click on Reload Project点击重新加载项目
  4. Wait the poem.xml archive reload等待poem.xml存档重新加载

I hope it works for you too :)我希望它也适用于你:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未找到依赖项 'org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE' - Dependency 'org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE' not found “依赖&#39;org.springframework.boot:spring-boot-starter-log4j2:2.3.5.RELEASE&#39;未找到” - "Dependency 'org.springframework.boot:spring-boot-starter-log4j2:2.3.5.RELEASE' not found " 未找到依赖项 '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 未找到依赖项 &#39;org.springframework.boot:spring-boot-starter-data-jpa:2.5.3&#39; - Dependency 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.3' not found 未找到 spring-boot-starter-validation - spring-boot-starter-validation 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-starter-parent:2.4.0' 未找到 - org.springframework.boot:spring-boot-starter-parent:2.4.0' not found 无法传输工件 org.springframework.boot:spring-boot-starter-parent:pom - Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom 无法解析 org.springframework.boot:spring-boot-starter-thymeleaf - Unable to resolve org.springframework.boot:spring-boot-starter-thymeleaf 找不到 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
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM