'How to fix "plugin was not found in any of the following sources"

I created a Spring MVC project ion Intellij IDEA. When I build my project, following message is displayed, how can I resolve it?

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

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.7.RELEASE')
  Searched in the following repositories:
    Gradle Central Plugin Repository


Solution 1:[1]

I saw the problem even on command line and it helped when I added plugin management to the start of setting.gradle file:

pluginManagement {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
        gradlePluginPortal()
    }
}

Solution 2:[2]

In my case, the issue was incorrect Gradle JVM version had to be changed in the gradle settings.

On changing the gradle JVM version to the Project's JVM version, this error got resolved.

enter image description here

Solution 3:[3]

I checked my proxy, it only access to a number of pages so the situation is on, after contacting technical staff, it worked.

Solution 4:[4]

You can be missing a plugin repository as mentioned by other people. In a corporate environment if custom plugins can be presented in build files then a plugin repository URL, user & pass need to be set somehow. The easiest way to do that is through a file ~/.gradle/gradle.properties and a snippet adding that custom repo in projects's settings.gradle.

Solution 5:[5]

add this to settings.gradle file

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rostislav Matl
Solution 2 Sendhilkumar Alalasundaram
Solution 3 steven nguyen
Solution 4 MaxNevermind
Solution 5 Ebuka Udeani