ekm0d
ekm0d

Reputation: 93

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" ?

My pom.xml file loks like this:

<?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?

Upvotes: 1

Views: 8682

Answers (4)

richie101
richie101

Reputation: 21

In my case I had problems with the following two dependencies:

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

<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <scope>runtime</scope>
</dependency>

I didn't have to add anything, I just followed the steps suggested by @Emesson Cavalcante and one extra step:

  1. Right-click on the project file.
  2. Click on Maven
  3. Click on Reload Project
  4. Wait the poem.xml archive reload
  5. Install plugins suggested by IntelliJ (when a popup appears)

Upvotes: 0

Emesson Cavalcante
Emesson Cavalcante

Reputation: 124

@ekm0d. I had the same problem using the Intellij IDEA. Here what I did and worked for me after inserting this on 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
  3. Click on Reload Project
  4. Wait the poem.xml archive reload

I hope it works for you too :)

Upvotes: 11

Lucky
Lucky

Reputation: 29

You should try to close the project and re-open it, the dependency will get downloaded by itself.

Worked in my case.

Upvotes: 0

user1598069
user1598069

Reputation: 13

Works for me. Central repo have this dependency: 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. 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

Upvotes: 1

Related Questions