Sophie Bushchak
Sophie Bushchak

Reputation: 161

Gradle cannot find Spring Boot 3.0.0-M1

I'm not sure how to debug this or what is wrong at all. I am trying to run this project: https://github.com/spring-projects/spring-security-samples/tree/main/servlet/spring-boot/java/jwt/login

In the project, Spring Boot 3.0.0-M1 is used to show the latest possibilities of JWT authentication. However, my Gradle cannot find this Spring Boot version no matter what I do. When I set it to 2.6.6 it works again, but it doesn't seem to be able to find 3.0.0-M1.

When I try to sync the dependencies I get the following error:

Build file 'C:\my files\general\subjects\programming\Open-source\spring-security-samples\servlet\spring-boot\java\jwt\login\build.gradle' line: 2

Plugin [id: 'org.springframework.boot', version: '3.0.0-M1'] was not found in any of the following sources:

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

The Gradle configuration is as follows:

plugins {
    id 'org.springframework.boot' version '3.0.0-M1'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/milestone" }
    maven { url "https://repo.spring.io/snapshot" }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
    implementation 'org.springframework.boot:spring-boot-starter-web'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

tasks.withType(Test).configureEach {
    useJUnitPlatform()
    outputs.upToDateWhen { false }
}

Upvotes: 4

Views: 4792

Answers (1)

Sophie Bushchak
Sophie Bushchak

Reputation: 161

I was able to fix it by downloading a 3.0.0-M2 project from Spring Initializr and seeing what differs between the example I got from the Spring Security examples repository and the generated project from Spring Initializr.

It turns out that adding the following to settings.gradle fixes it:

pluginManagement {
    repositories {
        maven { url 'https://repo.spring.io/milestone' }
        gradlePluginPortal()
    }
}

I am not sure why the example project didn't have this already.

Upvotes: 7

Related Questions