Skip to content

How to resolve 'Could not resolve all files for configuration' problem

Problem

When running a Spring Boot application with Gradle, you might encounter the following error or warning message:

Terminal window
Execution failed for task ':app9:compileJava'.
> Could not resolve all files for configuration ':app9:compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-jpa:.
Required by:
project :app9
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

The core error is:

Terminal window
Could not resolve all files for configuration xxx
Could not find org.springframework.boot:spring-boot-starter-jpa

Why does this error occur?

Environment

  • JDK 8
  • Gradle 6.x

Our build.gradle is as follows:

build.gradle
dependencies {
...
implementation 'org.springframework.boot:spring-boot-starter-jpa'
...
}

Reason

The dependency org.springframework.boot:spring-boot-starter-jpa does not exist. Let’s check all the starters:

NameDescription
spring-boot-starterCore starter, including auto-configuration support, logging, and YAML
spring-boot-starter-data-jpaStarter for using Spring Data JPA with Hibernate

Solution

Change the name of the starter from org.springframework.boot:spring-boot-starter-jpa to org.springframework.boot:spring-boot-starter-data-jpa:

build.gradle
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
}

Run the app again, and the error messages will disappear. It works!

Summary

In this post, we explored how to resolve the “Could not resolve all files for configuration” error in Spring Boot applications using Gradle. The key takeaway is to ensure that the correct dependency names are used in your build.gradle file. By changing the dependency from spring-boot-starter-jpa to spring-boot-starter-data-jpa, the error is resolved, and the application runs successfully. Always refer to the official documentation to verify the correct names of the dependencies.

Final Words + More Resources

My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!