How to fix "plugin was not found in any of the following sources"
Asked Answered
S

15

59

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
Snivel answered 28/8, 2019 at 8:53 Comment(4)
The Gradle central plugin repository definitely has that plugin (here). Are you sure you had a working internet connection when you tried to run?Cinderella
Thank your answer, my computer is still connected to the internet while building the project, but the result is the same.Snivel
Check if you need a proxy to access the internet. Otherwise do you have a settings.xml properly configured in your local .m2 config. You maybe need a definition to maven central repo....Unilobed
Yes, my proxy has been blocked, my IT has opened the proxy for me.Thank youSnivel
B
36

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()
    }
}
Bowls answered 18/6, 2020 at 16:12 Comment(0)
F
32

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

Feudalize answered 5/5, 2020 at 4:30 Comment(0)
B
28

add this at the beginning of settings.gradle file

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
Bestrew answered 11/5, 2022 at 6:19 Comment(0)
S
2

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

Snivel answered 29/8, 2019 at 6:21 Comment(2)
I'm having the same problem. What URL did you tell your proxy team you were trying to reach? I'll need to do the same.Irksome
Thanks for the tip with the proxy. In my organization we use cntlm which is coupeled to my Windows password. Today I've changed it and updated my .ini file accordingly, however I always forget to update my proxy password in IntelliJ also. Now everything works.Falcate
L
2

I fixed it by changing the gradle JDK

enter image description here

Lamed answered 26/5, 2023 at 14:17 Comment(0)
G
2

Do gradle build or ./gradlew build before sync to cache all of these dependencies and plugins, some IDEs corrupt at this point

Gastrotrich answered 2/9, 2023 at 20:13 Comment(0)
H
1

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.

Harmonica answered 1/2, 2021 at 15:9 Comment(1)
I found the easiest way to circumvent is set gradle user name to current working directory like export GRADLE_USER_HOME=$PWD to avoid global gradle options, given one know what they are doingBiafra
B
1
  • In my case it was the incorrect jvm with gradle and the project in itself, it will not find the correct plugins if its on the wrong version of Java etc.
  • Solution: CMD + , then check the jvm version
  • Perhaps putting the path to the jdk as an environment variable incase you need to use it again, it will save time.
Bliss answered 7/2, 2023 at 12:12 Comment(0)
A
0

In my case, gradle couldn't see my keystore. If you are using Windows Subsystem for Linux, gradle seems to be able to see keystores in the Windows filesystem (/mnt). Also, gradle seems to not be able to resolve home folder paths defined with the tilde:

  • This does not work: ~/cacerts
  • This does work: /home/me/cacerts
Anatomize answered 22/8, 2022 at 18:42 Comment(0)
H
0

My java environment in wsl was configured to work within my company environment with maven. Gradle needed more access so I needed to discover, acquire, and import external certificates to my cacerts. Unfortunately, gradle was not returning information that clearly pointed out that it was a certificate and access problem. It was saying it had searched a set of repositories and not found the resource. The errors read as if gradle could access the repo, but not find the resource. Not that gradle could not access the repo.

So, I used Chrome to navigate to the various repos in my build.gradle and determined which repos I need to access and started with gradle.org. I exported the cert from the browser then imported it to my cacert with:

sudo keytool -importcert -trustcacerts -cacerts -storepass changeit -file ~/gradle.org.crt -alias gradleplugins

After importing that cert I confirmed that no gradle daemon was running and tried my gradle clean command again. I iterated through each subsequent 'PKIX path building failed:' error I received and exported and imported each cert until success.

Hindermost answered 26/3, 2023 at 13:53 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Festus
what is gradle.org.crt? one you downloaded from chrome? Where is your cacert? There is on under jdk's security folder? Are you updating that as well?Witham
B
0

In my case, I deleted .gradle directory and File > Invalidate caches then, problem resolved. I thought gradle plugins, library version were not problem.

Burgenland answered 19/4, 2023 at 2:14 Comment(0)
M
0

In my case, I load some plugins from a corporate github repository for which I have to specify Credentials. I was loading these from settings in local.properties:

 plg.user="fredbloggs"
 plg.token="thetoken"

Of course, once I removed those quotation marks it worked fine:

 plg.user=fredbloggs
 plg.token=thetoken
Mordred answered 28/11, 2023 at 1:59 Comment(0)
P
0

I tried enabling the --debug flag but everything looked ok and the plugin POM seemed to be accessible with no error (and was accessible in the browser):

2024-01-30T11:08:08.507+1100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Download https://plugins.gradle.org/m2/com/gorylenko/gradle-git-properties/com.gorylenko.gradle-git-properties.gradle.plugin/2.4.0/com.gorylenko.gradle-git-properties.gradle.plugin-2.4.0.pom'

Immediately after that log I got the error posted in the original comment with no details of the cause. If I commented out all the plugins and ran Gradle again, all the other dependencies were downloaded fine so it just seemed to be plugins.

What I had forgotten is that our organisation requires a security proxy on company laptops that uses its own Man-in-the-Middle Certificate which is not trusted by anything by default and must be installed wherever needed.

Similarly to one of the other commenters, adding the proxy certificates to $JAVA_HOME/lib/security/cacerts fixed the issue.

I have no idea why downloading dependencies worked and can only surmise that Gradle is inconsistent in checking for self-signed certificates.

Patentor answered 30/1 at 0:20 Comment(1)
Disconnecting from VPN resolved the issue for me.Hofmann
A
0

This could be because of unavailability of internet connection or you have enable offline sync. To disable offline sync navigate to .idea/gradle.xml and remove <option name="offlineMode" value="true" /> and retry to sync

Akiko answered 13/2 at 5:47 Comment(0)
D
0

I also faced the similar issue in intellij, the reason was I recently updated my system password which was configured in JFrog and associated with .gradle.properties.

Step 1: Go to JFrog and edit your profile. Step 2: Set password and generate the API key and encrypted password. Step 3: Go to gradle.properties file in the system and paste the encrypted password.

Restart intellij.

Dannadannel answered 23/5 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.