Home > Blockchain >  Could not find org.springframework.boot:spring-boot-starter-web:. Required by: project :
Could not find org.springframework.boot:spring-boot-starter-web:. Required by: project :

Time:05-02

I'm new to spring and trying to use Spring Web dependency with spring boot.

Here is my build.gradle

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

    group = 'com.example'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = '11'

    repositories {
    mavenCentral()
}

    dependencies {
    implementation 'org.springframework.boot:spring- boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

    tasks.named('test') {
    useJUnitPlatform()
}

but when gradle sync, it returned errors

    spring-overview:test: Could not find org.springframework.boot:spring-boot-starter-web:.
Required by:
    project :

And another error page here:

org.gradle.api.GradleException: Failed to resolve imported Maven boms: Connection refused: no further information
    at io.spring.gradle.dependencymanagement.internal.DependencyManagement.resolveIfNecessary(DependencyManagement.java:157)
    at io.spring.gradle.dependencymanagement.internal.DependencyManagement.getManagedVersions(DependencyManagement.java:121)
    at io.spring.gradle.dependencymanagement.internal.DependencyManagementContainer.getManagedVersionsForConfiguration(DependencyManagementContainer.java:202)
    at io.spring.gradle.dependencymanagement.internal.DependencyManagementContainer.getManagedVersionsForConfiguration(DependencyManagementContainer.java:187)
    at io.spring.gradle.dependencymanagement.internal.DependencyManagementApplier$1.execute(DependencyManagementApplier.java:76)
    at io.spring.gradle.dependencymanagement.internal.DependencyManagementApplier$1.execute(DependencyManagementApplier.java:72)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:123)
    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:95)
    
    ... more

CodePudding user response:

First for Spring boot use Eclipse or Spring Tool Suite which will be best for spring boot. And then if your Getting like this type of error.. then your spring boot haven't installed properly in out Editor. Better Try uninstall and reinstall or change your editor and STS or Eclipse... Thank You... Further any clarification just comment below...

CodePudding user response:

seems like there is extra whitespace in spring-boot-starter-web implementation 'org.springframework.boot:spring- boot-starter-web' . Can you remove he whitespace and do gradle build

  • Related