We have a project with many modules where we have centralized versions in a java platform module.
In gradle 7.6 this worked fine:
dependencies {
compileClasspath enforcedPlatform(project(":project-dependencies"))
compileOnly enforcedPlatform(project(":project-dependencies"))
compileOnly 'org.mapstruct:mapstruct'
(Note: This is simplified: The enforcedPlatform dependencies are inside an allProjects
block in the main build.gradle)
In gradle 7.6 this worked fine (without any deprecation warnings).
In gradle 8.0.1 this results in
An exception occurred applying plugin request [id: 'java']
> Failed to apply plugin 'org.gradle.java'.
> Dependencies can not be declared against the `compileClasspath` configuration.
When I remove the compileClasspath enforcedPlatform(project(":project-dependencies"))
this is what get:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sub-project:compileJava'.
> Could not resolve all files for configuration ':sub-project:compileClasspath'.
> Could not find org.mapstruct:mapstruct:.
Required by:
project :sub-project
which is also strange, because the mapstruct dependency is in compileOnly configuration for which the platform dependency is present.
Also: I have not found any notes about “It is now impossible to define dependency against the compileClasspath configuration” in the update notes.