When I try to build a Gradle Spring Boot project with Spring Cloud Stream I receive the following error:
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find org.springframework.cloud:spring-cloud-stream:test-binder.
Required by:
project :
> Could not find org.springframework.cloud:spring-cloud-stream:test-binder.
Required by:
project :
> Could not find org.springframework.cloud:spring-cloud-stream:test-binder.
Required by:
project : > org.springframework.cloud:spring-cloud-stream-binder-kafka-streams:3.0.9.RELEASE > org.springframework.cloud:spring-cloud-stream-binder-kafka-core:3.0.9.RELEASE
The project works fine if I remove the following dependency:
testImplementation 'org.springframework.cloud:spring-cloud-stream:test-binder@test-jar'
The project was generated using Spring initilizr with this configuration.
What can I change so the project builds successfully?
Change
testImplementation 'org.springframework.cloud:spring-cloud-stream:test-binder@test-jar'
to
testImplementation("org.springframework.cloud:spring-cloud-stream") {
artifact {
name = "spring-cloud-stream"
extension = "jar"
type ="test-jar"
classifier = "test-binder"
}
}
Currently, Spring Initializr generates Gradle projects with this error and the problem is documented in #1159 and #591.