Skip to content

Spring Boot dependency management not working for ehcache when using Gradle and the dependency management plugin #37243

@shollander

Description

@shollander

When using Spring Boot with the dependency management plugin, users are supposed to be able to specify dependencies without a version and the Spring Boot managed version will be used. This usually works well. However, with SB 3.1 I have found that it fails to resolve the ehcache dependency when used without specifying a version.

This is a sample build.gradle file that fails:

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.1.3'
	id 'io.spring.dependency-management' version '1.1.3'
}

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

java {
	sourceCompatibility = '17'
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-cache'
	implementation 'org.ehcache:ehcache'

	testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

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

If I run a build using this file I get the following error message:

$ ./gradlew build
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.ehcache:ehcache:.
     Required by:
         project :

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3s
1 actionable task: 1 executed

This used to work with SB 2.7, and still works for other dependencies that I use. For some reason, the ehcache dependency is not working with SB dependency management.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions