Search code examples
spring-bootintellij-ideaspring-cloud-vault-config

Gradle could not resolve org.springframework.vault:spring-vault-core


I have a project that adopts Spring Vault to fetch credential. Dependencies of the project are as following and build.gradle file is generated automatically afterwards.

enter image description here

When I build the project I got the error

Could not resolve org.springframework.vault:spring-vault-core:2.2.2.RELEASE.

Possible solution:

I have checked the libraries by going to the Project Structures and got the weird thing

enter image description here

The weird thing I mean here is about the path of the jar file. It should be something like

%GRADLE_HOME%\caches\modules-2\files-2.1\org.springframework.cloud\spring-cloud-vault-config\2.2.3.RELEASE\5fd5a06deb01db77eb3e9b8e723ccc1e0790c420

How can I fix this issue in IntelliJ?


Solution

  • When you get an error about could not resolve dependencies in gradle, then there are several things you need to check.

    1. Proxy settings (should be inside gradle.properties)
    2. Permission for creating directories (particularly in %GRADLE_HOME%\caches\modules-2\files-2.1)

    For the problem of proxy setting, simply set values for the following fields inside gradle.properties

    systemProp.http.proxyHost=
    systemProp.http.proxyPort=
    systemProp.http.nonProxyHosts=
    systemProp.https.proxyHost=
    systemProp.https.proxyPort=
    systemProp.https.nonProxyHosts=
    

    For the problem of permission, try creating directories with the name of dependencies cannot be resolved, for example, org.springframework.vault at %GRADLE_HOME%\caches\modules-2\files-2.1. If you got permission denied or simply cannot create, then please contact your IT support!