Arpita Mitra
Arpita Mitra

Reputation: 33

Dependency 'org.springframework.boot:spring-boot-starter-security:2.2.6.RELEASE' not found

I am new to Spring so I would really appreciate if anyone of you can help me in this. I am adding a dependency of spring-boot-starter-security with a current version of 2.2.6.RELEASE and my parent is also having the same version. But still am getting an error-

Dependency 'org.springframework.boot:spring-boot-starter-security:2.2.6.RELEASE' not found .Tag name: artifactId Description : The unique id for an artifact produced by the project group, e.g. maven-artifact. Version : 3.0.0+ *

**Sorry in advance for any mistake ! **

<?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.2.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.arpita</groupId>
    <artifactId>security_first</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>security_first</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-web</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>2.2.6.RELEASE</version>
        </dependency>

Upvotes: 0

Views: 13177

Answers (5)

You don't need to mention the version but it depends. Your spring boot parens can have older version or newer version than you specify. If you specity older version it's not compiles. Erwin Smith wrote file -> invalidate caches/restart and it will work. which worked for me, but could not help you if the situation is as I wrote. Check the version in your parent pom if it's newer do invalidate caches/restart otherwise udate version to newer and it should work.

Upvotes: 0

Erwin Smith
Erwin Smith

Reputation: 75

file -> invalidate caches/restart and it will work.

Upvotes: 6

walkman
walkman

Reputation: 1

My suggestion is to install maven yourself. I have the same problem some times. And I think it is because of the Intellij. So I close the project which is a simple spring boot project to study and install maven by myself instead by Intellij. After configuring the environment variable in window 10, I reopen the project and it appears everything is ok now.

Upvotes: 0

Naresh
Naresh

Reputation: 54

you no need to mention the version of the spring boot project it will take care by spring boot add the below dependency

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

finally, update the your project

Upvotes: 1

Tarun
Tarun

Reputation: 723

BTW you don't need to specify version for starter POM. If you remove the version tag from security starter , it should work fine.

Upvotes: 2

Related Questions