Skip to content

Layered bootJar task causes warnings when custom source set is present in the project #22200

@dmurat

Description

@dmurat

I'm using bootJar task with a layered feature enabled on a project with the custom source set - testIntegration. Everything works as expected and there are no errors of any kind. However, Gradle produces warnings in the output like in the following truncated example:

The testIntegrationCompile configuration has been deprecated for resolution. This will fail with an error in Gradle 7.0 ...
The testIntegrationCompileOnly configuration has been deprecated for resolution. This will fail with an error in Gradle 7.0 ...
The testIntegrationRuntime configuration has been deprecated for resolution. This will fail with an error in Gradle 7.0 ...

After some debugging, I was able to pin the cause at the LayerResolver.processConfiguration() private method. It uses the DEPRECATED_FOR_RESOLUTION_CONFIGURATIONS for filtering Configurations that should not be resolved for dependencies. Since my project contains a custom source set with corresponding configurations extended from testImplementation and testRuntimeOnly, deprecated configurations sneak-in via Gradle's configuration hierarchy.

As bootJar tasks already filters-out hardcoded set of deprecated configuration names, maybe it makes sense to expand this filtering for custom configurations whose names end with Compile, CompileOnly and Runtime. When Gradle 7.0 will be released, I guess warnings will not be present since I'm expecting that Gradle will not include deprecated configurations in the hierarchy built with extendsFrom.

I don't have a simple example for demonstrating the issue, but you can check out this project project and run ./gradlew -p cargotracker/cargotracker-booking-queryside-rdbms-projection-app clean bootJar --warning-mode all from project root. Related build.gradle is here.

Spring Boot: 2.3.1.RELEASE
Gradle: 6.5
JDK: 11.0.7

Tnx.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions